/* ============================================================
   BERITAJA AI SOCIAL MEDIA CAPTION GENERATOR
   Main Stylesheet
   ============================================================ */

:root {
    --primary: #0b2668;
    --primary-dark: #071b4d;
    --primary-light: #163b9b;

    --accent: #db9d44;
    --accent-light: #f3c46d;

    --background: #f4f7fc;
    --surface: #ffffff;
    --surface-soft: #f8faff;

    --text: #172033;
    --text-light: #68738a;
    --text-muted: #8b95a7;

    --border: #e3e8f1;

    --success: #198754;
    --danger: #dc3545;

    --shadow-sm:
        0 4px 16px rgba(11, 38, 104, 0.06);

    --shadow:
        0 12px 35px rgba(11, 38, 104, 0.09);

    --shadow-lg:
        0 20px 55px rgba(11, 38, 104, 0.14);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;

    --container: 1120px;
}


/* ============================================================
   RESET
============================================================ */

* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    margin: 0;
    padding: 0;

    background:
        linear-gradient(
            180deg,
            #f8faff 0%,
            var(--background) 100%
        );

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    line-height: 1.6;
}


button,
input,
textarea,
select {
    font: inherit;
}


button {
    cursor: pointer;
}


/* ============================================================
   PAGE CONTAINER
============================================================ */

.tool-container {
    width: min(
        calc(100% - 40px),
        var(--container)
    );

    margin: 0 auto;
}


/* ============================================================
   HEADER
============================================================ */

.tool-header {
    padding: 30px 0 20px;

    text-align: center;
}


.tool-brand {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 9px;

    margin-bottom: 14px;

    color: var(--primary);

    font-size: 14px;
    font-weight: 800;

    letter-spacing: .08em;

    text-transform: uppercase;
}


.tool-brand-mark {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    border-radius: 9px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-light)
        );

    color: #fff;

    font-size: 15px;
}


.tool-header h1 {
    max-width: 780px;

    margin: 0 auto 14px;

    color: var(--primary-dark);

    font-size: clamp(
        32px,
        5vw,
        52px
    );

    line-height: 1.1;

    letter-spacing: -0.035em;
}


.tool-header h1 span {
    color: var(--accent);
}


.tool-header p {
    max-width: 700px;

    margin: 0 auto;

    color: var(--text-light);

    font-size: 17px;
}


/* ============================================================
   MAIN GRID
============================================================ */

.tool-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 0.9fr)
        minmax(0, 1.1fr);

    gap: 26px;

    align-items: start;

    padding: 20px 0 50px;
}


/* ============================================================
   CARD
============================================================ */

.tool-card {
    background: var(--surface);

    border:
        1px solid
        var(--border);

    border-radius:
        var(--radius-lg);

    box-shadow:
        var(--shadow);

    overflow: hidden;
}


.tool-card-header {
    padding: 25px 28px 18px;

    border-bottom:
        1px solid
        var(--border);
}


.tool-card-header h2 {
    margin: 0 0 5px;

    color: var(--primary-dark);

    font-size: 21px;
}


.tool-card-header p {
    margin: 0;

    color: var(--text-light);

    font-size: 14px;
}


.tool-card-body {
    padding: 28px;
}


/* ============================================================
   FORM
============================================================ */

.form-group {
    margin-bottom: 20px;
}


.form-group:last-child {
    margin-bottom: 0;
}


.form-label {
    display: block;

    margin-bottom: 8px;

    color: var(--text);

    font-size: 14px;

    font-weight: 700;
}


.form-label .required {
    color: var(--danger);
}


.form-help {
    display: block;

    margin-top: 6px;

    color: var(--text-muted);

    font-size: 12px;
}


.form-control {
    display: block;

    width: 100%;

    padding: 13px 15px;

    border:
        1px solid
        var(--border);

    border-radius:
        var(--radius-sm);

    outline: none;

    background: #fff;

    color: var(--text);

    font-size: 14px;

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}


.form-control::placeholder {
    color: #a4acba;
}


.form-control:hover {
    border-color: #cbd3e2;
}


.form-control:focus {
    border-color:
        var(--primary-light);

    box-shadow:
        0 0 0 4px
        rgba(22, 59, 155, .09);
}


textarea.form-control {
    min-height: 130px;

    resize: vertical;
}


select.form-control {
    cursor: pointer;
}


/* ============================================================
   TWO COLUMN FORM
============================================================ */

.form-row {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 15px;
}


/* ============================================================
   CHARACTER COUNTER
============================================================ */

.textarea-wrapper {
    position: relative;
}


.character-counter {
    position: absolute;

    right: 12px;
    bottom: 9px;

    padding: 2px 7px;

    border-radius: 6px;

    background:
        rgba(255, 255, 255, .9);

    color: var(--text-muted);

    font-size: 11px;

    pointer-events: none;
}


/* ============================================================
   GENERATE BUTTON
============================================================ */

.generate-button {
    position: relative;

    display: flex;

    width: 100%;

    min-height: 50px;

    align-items: center;
    justify-content: center;

    gap: 9px;

    margin-top: 24px;

    padding: 13px 20px;

    border: 0;

    border-radius:
        var(--radius-sm);

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-light)
        );

    color: #fff;

    font-size: 15px;

    font-weight: 800;

    box-shadow:
        0 8px 20px
        rgba(11, 38, 104, .2);

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        opacity .2s ease;
}


.generate-button:hover {
    transform: translateY(-1px);

    box-shadow:
        0 12px 26px
        rgba(11, 38, 104, .25);
}


.generate-button:active {
    transform: translateY(0);
}


.generate-button:disabled {
    cursor: not-allowed;

    opacity: .7;

    transform: none;

    box-shadow: none;
}


/* ============================================================
   BUTTON ICON
============================================================ */

.button-icon {
    display: inline-flex;

    width: 20px;
    height: 20px;

    align-items: center;
    justify-content: center;
}


/* ============================================================
   LOADING
============================================================ */

.loading-spinner {
    width: 17px;
    height: 17px;

    border:
        2px solid
        rgba(255, 255, 255, .35);

    border-top-color:
        #fff;

    border-radius: 50%;

    animation:
        spin .7s linear infinite;
}


@keyframes spin {

    to {
        transform:
            rotate(360deg);
    }

}


/* ============================================================
   RESULTS AREA
============================================================ */

.results-card {
    min-height: 500px;
}


.results-empty {
    display: flex;

    min-height: 430px;

    padding: 35px;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}


.results-empty-icon {
    display: flex;

    width: 68px;
    height: 68px;

    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    border-radius: 20px;

    background:
        #eef3ff;

    color:
        var(--primary);

    font-size: 28px;
}


.results-empty h3 {
    margin: 0 0 8px;

    color: var(--primary-dark);

    font-size: 19px;
}


.results-empty p {
    max-width: 420px;

    margin: 0;

    color: var(--text-light);

    font-size: 14px;
}


/* ============================================================
   RESULT HEADER
============================================================ */

.results-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 18px;
}


.results-title {
    margin: 0;

    color: var(--primary-dark);

    font-size: 20px;
}


.results-count {
    display: inline-flex;

    align-items: center;

    padding: 5px 10px;

    border-radius: 999px;

    background:
        #eef3ff;

    color:
        var(--primary);

    font-size: 12px;

    font-weight: 800;
}


/* ============================================================
   CAPTION ITEM
============================================================ */

.caption-list {
    display: flex;

    flex-direction: column;

    gap: 16px;
}


.caption-item {
    position: relative;

    padding: 20px;

    border:
        1px solid
        var(--border);

    border-radius:
        var(--radius);

    background:
        var(--surface-soft);

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        transform .2s ease;
}


.caption-item:hover {
    border-color:
        #cbd6eb;

    box-shadow:
        var(--shadow-sm);

    transform:
        translateY(-1px);
}


.caption-item-top {
    display: flex;

    align-items: center;
    justify-content: space-between;

    margin-bottom: 12px;
}


.caption-number {
    display: inline-flex;

    width: 30px;
    height: 30px;

    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background:
        var(--primary);

    color: #fff;

    font-size: 12px;

    font-weight: 800;
}


.copy-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 7px 11px;

    border:
        1px solid
        var(--border);

    border-radius: 8px;

    background: #fff;

    color: var(--primary);

    font-size: 12px;

    font-weight: 700;

    transition:
        background .2s ease,
        border-color .2s ease;
}


.copy-button:hover {
    background:
        #eef3ff;

    border-color:
        #cbd6eb;
}


.copy-button.copied {
    color:
        var(--success);

    border-color:
        rgba(25, 135, 84, .25);

    background:
        rgba(25, 135, 84, .06);
}


.caption-text {
    margin: 0;

    color: var(--text);

    font-size: 14px;

    line-height: 1.75;

    white-space: pre-wrap;

    word-break: break-word;
}


.caption-hashtags {
    margin-top: 14px;

    padding-top: 12px;

    border-top:
        1px solid
        var(--border);

    color:
        var(--primary-light);

    font-size: 13px;

    font-weight: 600;

    line-height: 1.7;
}


/* ============================================================
   ERROR
============================================================ */

.tool-error {
    display: none;

    margin-top: 16px;

    padding: 13px 15px;

    border:
        1px solid
        rgba(220, 53, 69, .2);

    border-radius:
        var(--radius-sm);

    background:
        rgba(220, 53, 69, .05);

    color:
        #b02a37;

    font-size: 13px;

    line-height: 1.5;
}


.tool-error.show {
    display: block;
}


/* ============================================================
   SUCCESS MESSAGE
============================================================ */

.tool-success {
    display: none;

    margin-top: 16px;

    padding: 13px 15px;

    border:
        1px solid
        rgba(25, 135, 84, .2);

    border-radius:
        var(--radius-sm);

    background:
        rgba(25, 135, 84, .05);

    color:
        var(--success);

    font-size: 13px;
}


.tool-success.show {
    display: block;
}


/* ============================================================
   FOOTER
============================================================ */

.tool-footer {
    padding: 20px 0 40px;

    border-top:
        1px solid
        var(--border);

    text-align: center;

    color: var(--text-muted);

    font-size: 12px;
}


.tool-footer a {
    color:
        var(--primary);

    text-decoration: none;

    font-weight: 700;
}


.tool-footer a:hover {
    text-decoration: underline;
}


/* ============================================================
   TRUST NOTE
============================================================ */

.trust-note {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-top: 15px;

    color: var(--text-muted);

    font-size: 11px;

    line-height: 1.5;
}


.trust-note-icon {
    flex: 0 0 auto;

    display: flex;

    width: 20px;
    height: 20px;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        #eef3ff;

    color:
        var(--primary);

    font-size: 11px;
}


/* ============================================================
   TOOL FEATURES
============================================================ */

.feature-strip {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-top: 22px;
}


.feature-item {
    padding: 14px;

    border:
        1px solid
        var(--border);

    border-radius:
        var(--radius-sm);

    background:
        rgba(255,255,255,.7);

    text-align: center;
}


.feature-item strong {
    display: block;

    margin-bottom: 2px;

    color:
        var(--primary-dark);

    font-size: 13px;
}


.feature-item span {
    color:
        var(--text-muted);

    font-size: 11px;
}


/* ============================================================
   RESPONSIVE TABLET
============================================================ */

@media (max-width: 900px) {

    .tool-grid {
        grid-template-columns:
            1fr;
    }


    .results-card {
        min-height: auto;
    }


    .results-empty {
        min-height: 300px;
    }

}


/* ============================================================
   RESPONSIVE MOBILE
============================================================ */

@media (max-width: 640px) {

    .tool-container {
        width:
            min(
                calc(100% - 24px),
                var(--container)
            );
    }


    .tool-header {
        padding-top: 22px;
    }


    .tool-header h1 {
        font-size: 32px;
    }


    .tool-header p {
        font-size: 14px;
    }


    .tool-card-header {
        padding:
            20px;
    }


    .tool-card-body {
        padding:
            20px;
    }


    .form-row {
        grid-template-columns:
            1fr;

        gap: 0;
    }


    .feature-strip {
        grid-template-columns:
            1fr;
    }


    .results-empty {
        padding:
            25px 20px;
    }


    .caption-item {
        padding:
            16px;
    }


    .results-header {
        align-items:
            flex-start;

        flex-direction:
            column;
    }

}


/* ============================================================
   ACCESSIBILITY
============================================================ */

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline:
        3px solid
        rgba(219, 157, 68, .45);

    outline-offset:
        2px;
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior:
            auto !important;

        animation-duration:
            .01ms !important;

        animation-iteration-count:
            1 !important;

        transition-duration:
            .01ms !important;
    }

}