/* ================================================
   AlphaPTS License Manager - Modern Mobile-First CSS
   ================================================ */

:root {
    --primary-color: #0066ff;
    --primary-dark: #0052cc;
    --secondary-color: #7c3aed;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --dark-color: #1a1a2e;
    --light-color: #f8f9ff;
    --border-color: #e0e7ff;
    --text-color: #1a1a2e;
    --text-light: #6b7280;
    --sidebar-width: 280px;
    --header-height: 60px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ================================================
   LOGIN FORM
   ================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    color: var(--dark-color);
    font-size: 28px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.login-box input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.btn-block {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

/* ================================================
   MAIN LAYOUT
   ================================================ */

.container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    gap: 0;
}

/* ================================================
   MOBILE MENU TOGGLE
   ================================================ */

.mobile-menu-toggle {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px;
    z-index: 103;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2.5px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(10px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-10px);
}

/* ================================================
   SIDEBAR
   ================================================ */

.sidebar {
    background: linear-gradient(135deg, var(--dark-color) 0%, #2a2a3e 100%);
    color: white;
    padding: 24px 16px;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    z-index: 100;
}

.logo {
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 20px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.logo p {
    font-size: 12px;
    opacity: 0.75;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.nav-item span:first-child {
    font-size: 18px;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* ================================================
   MAIN CONTENT
   ================================================ */

.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--light-color);
}

.header {
    background: white;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.header-left h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark-color);
}

.header-right {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 13px;
    color: var(--text-light);
}

.user-info {
    display: none;
}

.time-info {
    display: none;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 40px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   METRICS GRID
   ================================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.3s ease;
    border-left: 4px solid var(--border-color);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.metric-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.metric-card.alert {
    border-left-color: var(--warning-color);
}

.metric-card.alert .metric-value {
    color: var(--warning-color);
}

/* ================================================
   BUTTONS
   ================================================ */

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f0f4f8;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e6ecf1;
    border-color: #d0dce6;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================
   SECTION HEADER
   ================================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-color);
    flex: 1;
}

/* ================================================
   SEARCH BOX
   ================================================ */

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* ================================================
   TABLE
   ================================================ */

.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: linear-gradient(90deg, #f8f9ff 0%, #f0f4f8 100%);
    padding: 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8f9ff;
}

.data-table tbody tr.revoked {
    opacity: 0.6;
    background-color: #ffe0e0;
}

.data-table tbody tr.expired {
    opacity: 0.85;
    background-color: #fff3cd;
}

.text-center {
    text-align: center;
    color: var(--text-light);
}

/* ================================================
   FORMS
   ================================================ */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 13px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 11px 13px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.3s ease;
    background-color: white;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a2e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

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

.settings-form {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 500px;
}

.settings-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ================================================
   MODAL
   ================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 100%;
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h3 {
    margin: 0;
    font-weight: 700;
    color: var(--dark-color);
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--light-color);
    color: var(--text-color);
}

.modal-body {
    padding: 16px;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-info,
    .time-info {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

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

    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 102;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding-top: 0;
        overflow-y: auto;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar .logo {
        margin-top: 20px;
    }

    .header {
        padding: 0;
        position: relative;
        height: auto;
        z-index: 50;
    }

    .header-left {
        flex: 1;
        padding: 14px 16px 14px 60px;
        z-index: 1;
    }

    .header-left h2 {
        font-size: 18px;
        margin: 0;
    }

    .header-right {
        gap: 12px;
        padding: 14px 16px;
        width: 100%;
        justify-content: flex-end;
        order: 2;
    }

    .header-right .btn {
        padding: 8px 10px;
    }

    .content {
        padding: 16px;
        padding-top: 12px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-card {
        padding: 14px;
    }

    .metric-icon {
        font-size: 28px;
    }

    .metric-value {
        font-size: 24px;
    }

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

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }

    .search-box input {
        font-size: 16px;
        padding: 12px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }

    .data-table th {
        font-size: 11px;
    }

    .btn {
        padding: 9px 12px;
        font-size: 12px;
    }

    .btn-small {
        padding: 6px 8px;
        font-size: 11px;
    }

    .settings-buttons {
        flex-direction: column;
    }

    .settings-buttons .btn {
        width: 100%;
    }

    .nav-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo p {
        font-size: 11px;
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 10px 12px;
    }

    .modal-header h3 {
        font-size: 14px;
    }

    .modal-close {
        font-size: 20px;
        width: 24px;
        height: 24px;
    }

    .modal-body {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .header-left h2 {
        font-size: 16px;
    }

    .section-header h3 {
        font-size: 16px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .data-table {
        font-size: 11px;
    }

    .content {
        padding: 12px;
    }
}

/* ================================================
   UTILITIES
   ================================================ */

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-light);
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d1f3d1;
    color: var(--success-color);
}

.badge-danger {
    background: #fdd8d8;
    color: var(--danger-color);
}

.badge-warning {
    background: #fef0d8;
    color: var(--warning-color);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}
