/* Base styles for Interporto */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    color: #333;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.top-nav {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.layout-shell {
    display: flex;
    align-items: flex-start;
    width: 100%;
    min-height: calc(100vh - 70px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.logo {
    min-width: 0;
}

.logo span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}

.menu-toggle:hover {
    background: #f1f5f9;
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: #1e293b;
    color: white;
    min-height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    padding: 20px 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-section {
    padding: 15px 25px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-top: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: #cbd5e0;
    text-decoration: none;
    transition: all 0.2s;
}

.menu-item:hover, .menu-item.active {
    background: #334155;
    color: white;
}

.menu-item .icon { font-size: 18px; }

.main-content {
    flex: 1;
    padding: 30px;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    max-width: 100%;
}

.card-body {
    max-width: 100%;
    overflow-x: auto;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.card-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table th,
.table td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.nav-right {
    margin-left: auto;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    max-width: 45vw;
}

.user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    display: none;
    z-index: 120;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #1e293b;
}

.user-dropdown a:hover {
    background: #f8fafc;
}

.user-menu {
    position: relative;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #eef2f7;
}

.btn-primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-secondary {
    background: #ffffff;
    color: #334155;
}

.btn-sm {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    width: min(640px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    padding: 22px;
}

.modal-card h2 {
    margin: 0 0 16px;
    color: #0f172a;
    font-size: 30px;
}

.form-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.page-form {
    max-width: 980px;
}

.required-mark {
    color: #ef4444;
}

.check-row {
    margin-top: 6px;
}

.check-label {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.check-label input {
    width: auto;
    margin: 0;
}

.empty-state {
    color: #94a3b8;
    text-align: center;
    padding: 26px 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ffffff;
}

.stat-icon.blue {
    background: #2563eb;
}

.stat-icon.indigo {
    background: #6366f1;
}

.stat-icon.green {
    background: #16a34a;
}

.stat-icon.orange {
    background: #f59e0b;
}

.stat-icon.red {
    background: #ef4444;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

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

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

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

/* Login/Auth page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at 10% 10%, #1d4ed8 0%, #0f172a 40%, #111827 100%);
}

.auth-card {
    width: min(460px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    padding: 30px 24px;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(8px);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-badge {
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #2563eb, #1e40af);
    color: #fff;
    font-size: 28px;
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.35);
}

.auth-title {
    font-size: 30px;
    color: #0f172a;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: #64748b;
    font-size: 14px;
}

.auth-error {
    margin-bottom: 16px;
}

.field-with-icon {
    position: relative;
}

.field-with-icon input {
    padding-left: 42px;
}

.field-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 14px;
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}

.auth-footer {
    margin-top: 22px;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

@media (max-width: 992px) {
    .top-nav {
        padding: 12px 16px;
    }

    .main-content {
        padding: 18px;
    }

    .sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        height: 100vh;
        min-height: 100vh;
        z-index: 130;
        transition: left 0.25s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .layout-shell {
        display: block;
        min-height: auto;
    }

    .user-button {
        max-width: 52vw;
    }

    .table {
        min-width: 640px;
    }

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

@media (max-width: 640px) {
    .main-content {
        padding: 12px;
    }

    .logo span {
        max-width: 38vw;
        font-size: 14px;
    }

    .user-role {
        display: none;
    }

    .user-button {
        padding: 6px 8px;
        max-width: 48vw;
    }

    .table {
        min-width: 560px;
    }

    .modal-card {
        border-radius: 14px;
        padding: 16px;
    }

    .modal-card h2 {
        font-size: 24px;
    }

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

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

    .auth-card {
        border-radius: 16px;
        padding: 22px 16px;
    }

    .auth-title {
        font-size: 24px;
    }
}