/* JoyFi PisoWiFi Licensing System - Enhanced Styles */

:root {
    --primary: #0b72b9;
    --primary-dark: #085a91;
    --primary-light: #e8f4fc;
    --secondary: #ff7a00;
    --secondary-dark: #e66a00;
    --secondary-light: #fff0e0;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container.narrow {
    max-width: 480px;
}

.container.wide {
    max-width: 1400px;
}

/* Page Header */
.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.page-header nav a {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: var(--white);
    border: 1px solid var(--gray-200);
}

.page-header nav a:hover {
    color: var(--primary);
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.page-header nav a.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Header Nav with Button */
.header-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.header-nav span {
    padding: 8px 16px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius);
    font-weight: 500;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2,
.card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--gray-900);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Stats Grid */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stats .card {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
    border: 1px solid var(--gray-200);
}

.stats .card h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.stats .card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    align-items: end;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: white;
    transition: all 0.2s ease;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder {
    color: var(--gray-400);
}

/* Buttons */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    gap: 8px;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

button:active,
.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 100%);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary);
    border: 2px solid var(--secondary);
}

.btn-outline-secondary:hover {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert.success {
    background: var(--success-light);
    color: #065f46;
    border-color: var(--success);
}

.alert.error {
    background: var(--danger-light);
    color: #991b1b;
    border-color: var(--danger);
}

.alert.warning {
    background: var(--warning-light);
    color: #92400e;
    border-color: var(--warning);
}

.alert.info {
    background: var(--info-light);
    color: #1e40af;
    border-color: var(--info);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9375rem;
}

thead {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-300);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.available {
    background: var(--success-light);
    color: #065f46;
}

.badge.transferred {
    background: var(--warning-light);
    color: #92400e;
}

.badge.used {
    background: var(--danger-light);
    color: #991b1b;
}

.badge.primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge.secondary {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.badge.distributor {
    background: var(--info-light);
    color: #1e40af;
}

/* Mono Text */
.mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Profile Styles */
.profile-section {
    margin-bottom: 32px;
}

.profile-info {
    background: linear-gradient(135deg, var(--primary-light) 0%, white 100%);
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--primary-light);
}

.profile-info h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--primary);
    font-size: 1.25rem;
}

.profile-info p {
    margin: 8px 0;
    color: var(--gray-700);
}

.profile-info strong {
    color: var(--gray-900);
    display: inline-block;
    width: 140px;
    font-weight: 600;
}

.license-stats {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    flex: 1;
    min-width: 120px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.stat-box .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-box .label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Password Form */
.password-form,
.profile-form {
    max-width: 500px;
}

.password-form label,
.profile-form label {
    margin-bottom: 8px;
}

.password-form input,
.profile-form input {
    margin-bottom: 16px;
}

.password-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--gray-200);
}

.optional {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-style: italic;
    font-weight: 400;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    gap: 4px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-weight: 500;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.tab:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.tab.active {
    color: var(--primary);
    background: white;
    border-bottom: 2px solid var(--primary);
    margin-bottom: -2px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 32px;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.modal-content label {
    margin-bottom: 8px;
}

.modal-content input {
    margin-bottom: 16px;
}

.close {
    color: var(--gray-400);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close:hover {
    color: var(--gray-900);
}

/* Transfer History */
.transfer-history-section {
    margin-top: 24px;
}

.transfer-history-section h3 {
    font-size: 1.125rem;
    margin-bottom: 16px;
    color: var(--gray-900);
}

.transfer-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.transfer-history-table th,
.transfer-history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.transfer-history-table th {
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
}

.transfer-history-table tr:hover {
    background: var(--gray-50);
}

/* License Stats Display */
.license-stats {
    margin-bottom: 16px;
    font-size: 0.9375rem;
    color: var(--gray-600);
}

.license-stats span {
    margin-right: 16px;
}

.total-transferred {
    margin-top: 12px;
    font-size: 0.875rem;
    color: var(--gray-500);
    font-style: italic;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.my-3 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header nav {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .stats .card p {
        font-size: 2rem;
    }

    .license-stats {
        flex-direction: column;
    }

    .stat-box {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .page-header nav a {
        padding: 6px 12px;
        font-size: 0.875rem;
    }

    button,
    .btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .page-header nav,
    button,
    .btn {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
