:root {
    --primary-color: #1D4ED8;
    --primary-dark: #1E40AF;
    --secondary-color: #3B82F6;
    --text-color: #1E293B;
    --title-color: #0F172A;
    --muted-color: #64748B;
    --bg-color: #F8FBFF;
    --surface-color: #FFFFFF;
    --border-color: #D6E4FF;
    --soft-blue: #EAF2FF;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
}

a {
    color: inherit;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}

.site-header {
    margin-bottom: 24px;
}

.custom-navbar {
    background: transparent;
    padding: 0;
}

.brand-link {
    text-decoration: none;
    color: var(--title-color);
}

.header-subtitle {
    color: var(--muted-color);
    font-size: 0.95rem;
}

.nav-link-custom {
    text-decoration: none;
    color: var(--title-color);
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-link-custom:hover {
    background: var(--soft-blue);
    color: var(--primary-color);
}

.avatar-menu-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 999px;
    padding: 8px 12px;
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.08);
    cursor: pointer;
}

.avatar-user-info {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.avatar-small,
.avatar-tiny {
    object-fit: cover;
    border-radius: 999px;
    background: var(--soft-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-small {
    width: 46px;
    height: 46px;
}

.avatar-tiny {
    width: 32px;
    height: 32px;
}

.placeholder-avatar {
    color: var(--primary-dark);
    font-weight: bold;
}

.custom-dropdown {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    min-width: 240px;
}

.custom-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 500;
}

.custom-dropdown .dropdown-item:hover {
    background: var(--soft-blue);
    color: var(--primary-color);
}

.card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
    border: 1px solid rgba(214, 228, 255, 0.9);
}

.small-card {
    max-width: 640px;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--title-color);
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #bfd3f5;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text-color);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

button,
.button-link {
    text-decoration: none;
    background: var(--primary-color);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

button:hover,
.button-link:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.secondary-link {
    background: var(--secondary-color);
}

.secondary-link:hover {
    background: var(--primary-color);
}

button.danger,
.button-link.danger {
    background: #dc2626;
}

button.danger:hover,
.button-link.danger:hover {
    background: #b91c1c;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #e8f3ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.hint {
    color: var(--muted-color);
    font-size: 13px;
}

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pill {
    display: inline-block;
    background: var(--soft-blue);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 600;
}

.profile-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

.profile-photo-box {
    display: flex;
    flex-direction: column;
}

.profile-photo {
    width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.profile-photo.placeholder {
    color: #64748b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.full-width {
    grid-column: 1 / -1;
}

.button-row {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.danger-card {
    border: 1px solid #fecaca;
}

ul {
    margin-top: 0;
}

.compact-grid {
    max-width: 700px;
}

.category-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 20px;
}

.category-chip {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    background: #e7eefc;
    color: var(--title-color);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.category-chip:hover {
    background: var(--soft-blue);
    color: var(--primary-color);
}

.category-chip.active {
    background: var(--primary-color);
    color: #fff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 18px;
}

.design-card {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--surface-color);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.design-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
}

.design-card img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.design-card-body {
    padding: 16px;
}

.design-card h3 {
    margin: 10px 0 8px;
}

.design-card h3 a {
    text-decoration: none;
    color: var(--title-color);
}

.design-card h3 a:hover {
    color: var(--primary-color);
}

.design-meta {
    font-size: 13px;
    color: var(--muted-color);
}

.design-detail {
    display: grid;
    grid-template-columns: minmax(280px, 460px) 1fr;
    gap: 24px;
    align-items: start;
}

.design-preview {
    width: 100%;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border-color);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.comment-item {
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f1f6ff;
    color: var(--title-color);
}

.sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
}

.sort-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-link {
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--soft-blue);
    color: var(--primary-dark);
    font-weight: 600;
}

.table-link:hover {
    background: #dbeafe;
}

.table-link.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.table-link.danger:hover {
    background: #fecaca;
}

.form-intro {
    margin-bottom: 18px;
    color: var(--muted-color);
}

.auth-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

@media (max-width: 991px) {
    .navbar-collapse {
        margin-top: 16px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    .avatar-menu-trigger {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 900px) {
    .profile-layout,
    .design-detail {
        display: block;
    }

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

    .profile-photo {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

.admin-only-note {
    margin: 16px 0 0;
}

.profile-fields {
    min-width: 0;
}

.compact-profile-layout {
    grid-template-columns: 220px 1fr;
}

.empty-state {
    padding: 18px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    background: #fcfdff;
}

@media (max-width: 900px) {
    .compact-profile-layout {
        grid-template-columns: 1fr;
    }
}


.header-shell {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.desktop-nav {
    display: flex;
}

.mobile-nav {
    display: none;
    align-items: center;
    gap: 10px;
}

.mobile-menu-trigger {
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--title-color);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.08);
}

.mobile-avatar-link {
    text-decoration: none;
}

.mobile-dropdown-menu {
    min-width: 220px;
}

@media (max-width: 991.98px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-nav {
        display: flex;
    }

    .header-shell {
        align-items: flex-start;
    }
}


.alert.info {
    background: #eef6ff;
    color: #154c79;
    border: 1px solid #cfe3ff;
    border-radius: 12px;
    padding: 12px 14px;
}

.button-link.secondary {
    background: #4b5563;
}

.log-box {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 580px;
    overflow: auto;
    margin: 0;
}
.table-thumb {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.design-preview-small {
    max-width: 180px;
    max-height: 140px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.current-file-box {
    margin: 1rem 0;
    padding: 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
}


/* Miniaturas compactas en el listado de diseños del perfil */
.thumb-column {
    width: 76px;
}

.design-list-thumb-link {
    display: inline-block;
}

.design-list-thumb {
    width: 58px;
    height: 44px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: block;
    background: #f8fafc;
}

@media (max-width: 768px) {
    .design-list-thumb {
        width: 50px;
        height: 38px;
    }
}


/* Corrección final: miniaturas reales en tabla de diseños */
.table-wrapper table .thumb-column {
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
}

.table-wrapper table .design-list-thumb-link {
    display: inline-block !important;
    width: 48px !important;
    height: 36px !important;
    line-height: 0 !important;
}

.table-wrapper table img.design-list-thumb {
    width: 48px !important;
    height: 36px !important;
    max-width: 48px !important;
    max-height: 36px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    border: 1px solid #e5e7eb !important;
    display: block !important;
    background: #f8fafc !important;
}

.table-wrapper table .compact-cell {
    white-space: nowrap;
    vertical-align: middle;
}

.table-wrapper table td {
    vertical-align: middle;
}

.print-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.print-sheet {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.print-sheet-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.print-sheet-header h2 {
    margin: 14px 0 8px;
    color: var(--title-color);
}

.print-sheet-id {
    min-width: 96px;
    text-align: right;
    color: var(--muted-color);
}

.print-sheet-id span {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.print-sheet-id strong {
    display: block;
    color: var(--title-color);
    font-size: 1.6rem;
}

.print-sheet-main {
    display: grid;
    grid-template-columns: minmax(240px, 360px) 1fr;
    gap: 28px;
    align-items: start;
}

.print-sheet-image {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    object-fit: cover;
}

.print-sheet-data h3,
.print-sheet-description h3 {
    margin: 0 0 12px;
    color: var(--title-color);
}

.print-sheet-data dl {
    margin: 0;
}

.print-sheet-data dl div {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid #e5e7eb;
}

.print-sheet-data dt {
    color: var(--muted-color);
    font-weight: 700;
}

.print-sheet-data dd {
    margin: 0;
    color: var(--text-color);
}

.print-sheet-description {
    margin-top: 28px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

@media (max-width: 768px) {
    .print-sheet-main,
    .print-sheet-data dl div {
        grid-template-columns: 1fr;
    }

    .print-sheet-header {
        display: block;
    }

    .print-sheet-id {
        text-align: left;
        margin-top: 12px;
    }
}

@media print {
    @page {
        margin: 14mm;
    }

    body {
        background: #fff;
        color: #111827;
    }

    .site-header,
    .no-print,
    script {
        display: none !important;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .print-sheet {
        border: none;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .print-sheet-main {
        grid-template-columns: 45% 1fr;
    }

    .print-sheet-image {
        max-height: 95mm;
        object-fit: contain;
    }

    a {
        text-decoration: none;
    }
}
