/* ── Reset & Base ──────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #2B2B2B;
    color: #A8A8A8;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, h4 {
    color: #FFFFFF;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }


/* ── Layout ───────────────────────────────────────────────────────── */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}


/* ── Navbar ───────────────────────────────────────────────────────── */

.navbar {
    background-color: #1E1E1E;
    border-bottom: 1px solid #3A3A3A;
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #CC0000;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 6px;
}

.brand-text {
    color: #FFFFFF;
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: #A8A8A8;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #FFFFFF;
}


/* ── Footer ───────────────────────────────────────────────────────── */

.footer {
    border-top: 1px solid #3A3A3A;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
}


/* ── Page Header ──────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin: 0;
}

.subtitle {
    color: #888;
    font-size: 0.95rem;
    margin-top: 0.2rem;
}


/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: #CC0000;
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: #A80000;
}

.btn-primary:disabled {
    background-color: #7A0000;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-secondary {
    background-color: #3A3A3A;
    color: #CCCCCC;
}

.btn-secondary:hover {
    background-color: #444444;
    color: #FFFFFF;
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    background-color: #3A3A3A;
    color: #CCCCCC;
    border-radius: 4px;
}

.btn-sm:hover {
    background-color: #CC0000;
    color: #FFFFFF;
}

.btn-danger {
    background-color: transparent;
    color: #CC0000;
    border: 1px solid #CC0000;
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #CC0000;
    color: #FFFFFF;
}

.btn-danger-sm {
    background-color: transparent;
    color: #888;
    border: 1px solid #555;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.btn-danger-sm:hover {
    background-color: #CC0000;
    color: #FFFFFF;
    border-color: #CC0000;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}


/* ── Cards ────────────────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.project-card {
    background-color: #333333;
    border-radius: 8px;
    border: 1px solid #3A3A3A;
    transition: all 0.2s;
    overflow: hidden;
    display: block;
}

.project-card:hover {
    border-color: #CC0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card-header {
    padding: 1.25rem 1.25rem 0;
}

.card-header h2 {
    font-size: 1.15rem;
}

.card-body {
    padding: 0.75rem 1.25rem 1.25rem;
}

.card-url {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.report-count {
    color: #CC0000;
    font-weight: 500;
}

.card-date {
    color: #666;
}


/* ── Empty State ──────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-sm {
    padding: 2rem;
    background-color: #333333;
    border-radius: 8px;
    border: 1px dashed #444;
}

.empty-icon {
    margin-bottom: 1rem;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
    color: #888;
}


/* ── Error Page ───────────────────────────────────────────────────── */

.error-page {
    text-align: center;
    padding: 6rem 2rem;
}

.error-page h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}


/* ── Alerts ───────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-success {
    background-color: rgba(34, 154, 22, 0.15);
    border: 1px solid rgba(34, 154, 22, 0.3);
    color: #6FD864;
}

.alert-error {
    background-color: rgba(204, 0, 0, 0.15);
    border: 1px solid rgba(204, 0, 0, 0.3);
    color: #FF6666;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}


/* ── Section ──────────────────────────────────────────────────────── */

.section {
    margin-top: 2rem;
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3A3A3A;
}


/* ── Report List ──────────────────────────────────────────────────── */

.report-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background-color: #333333;
    border-radius: 6px;
    border: 1px solid #3A3A3A;
}

.report-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.report-name {
    font-size: 0.9rem;
    color: #CCCCCC;
}


/* ── Forms ─────────────────────────────────────────────────────────── */

.form-card {
    background-color: #333333;
    border: 1px solid #3A3A3A;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.form-card-title {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    display: inline;
}

.form-subtitle {
    font-size: 0.95rem;
    color: #CCCCCC;
    margin-bottom: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #3A3A3A;
}

.form-subtitle:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.form-hint {
    display: block;
    margin-top: 0.3rem;
    color: #777;
    font-size: 0.8rem;
}

.form-note {
    background: rgba(204, 0, 0, 0.08);
    border-left: 3px solid #CC0000;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 4px 4px 0;
    color: #A8A8A8;
    font-size: 0.85rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #CCCCCC;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.required {
    color: #CC0000;
}

.form-help {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background-color: #2B2B2B;
    border: 1px solid #4A4A4A;
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #CC0000;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: #666;
}

select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23888' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.5rem;
}

select option {
    background-color: #2B2B2B;
    color: #FFFFFF;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background-color: #2B2B2B;
    padding: 1rem 0;
    border-top: 1px solid #3A3A3A;
    margin-top: 0.5rem;
    z-index: 10;
}


/* ── Radio Buttons ────────────────────────────────────────────────── */

.radio-group {
    display: flex;
    gap: 1.5rem;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #CCCCCC;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #4A4A4A;
    border-radius: 50%;
    position: relative;
    transition: border-color 0.2s;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: #CC0000;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: #CC0000;
    border-radius: 50%;
}


/* ── File Upload ──────────────────────────────────────────────────── */

.file-upload {
    position: relative;
    border: 2px dashed #4A4A4A;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #666;
}

.file-upload.has-file {
    border-color: #CC0000;
    border-style: solid;
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    color: #888;
    font-size: 0.85rem;
}

.file-upload-name {
    display: none;
    color: #FFFFFF;
    font-weight: 500;
}


/* ── Collapsible Sections ─────────────────────────────────────────── */

.collapsible .collapse-content {
    display: none;
    padding-top: 1.25rem;
}

.collapsible.open .collapse-content {
    display: block;
}

.collapse-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: left;
    color: inherit;
    font-family: inherit;
}

.collapse-toggle .form-card-title {
    margin-bottom: 0;
}

.collapse-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    background: #2B2B2B;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.collapse-icon {
    margin-left: auto;
    color: #666;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.collapsible.open .collapse-icon {
    transform: rotate(180deg);
}


/* ── Spinner ──────────────────────────────────────────────────────── */

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .btn-lg {
        width: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem;
    }

    .brand-text {
        display: none;
    }
}
