* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.screen.active {
    display: block;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Styles */
.card {
    background: var(--card-background);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

/* Login Screen */
#loginScreen {
    min-height: 100vh;
}

#loginScreen.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

#loginScreen .card {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 14px;
}
.header-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    margin-bottom: 24px;
    opacity: 0.8;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 16px;
}
/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--card-background);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    font-weight: 400;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn.loading .spinner {
    display: inline-block;
}

.btn.loading span {
    opacity: 0;
}

.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    position: absolute;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.error-message,
.success-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
}

.error-message {
    background: #fee;
    color: var(--error-color);
    border: 1px solid #fcc;
}

.success-message {
    background: #efe;
    color: var(--success-color);
    border: 1px solid #cfc;
}

.error-message.show,
.success-message.show {
    display: block;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.dashboard-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-header h3 {
    font-size: 20px;
    font-weight: 600;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: var(--background);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background: var(--background);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-user {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.edit {
    background: #dbeafe;
    color: #1e40af;
}

.action-btn.edit:hover {
    background: #bfdbfe;
}

.action-btn.delete {
    background: #fee2e2;
    color: #991b1b;
}

.action-btn.delete:hover {
    background: #fecaca;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-background);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-content form {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-footer .btn {
    width: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 24px;
        border-radius: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-buttons {
        width: 100%;
        flex-direction: row;
    }

    h1 {
        font-size: 24px;
    }

    .dashboard-header h2 {
        font-size: 22px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }

    .table-container {
        margin: 0 -24px;
        padding: 0 24px;
    }

    .actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    #loginScreen .card {
        box-shadow: none;
        background: rgba(255, 255, 255, 0.95);
    }
}

/* PWA Install prompt */
.install-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-background);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-width: 90%;
    width: 400px;
    text-align: center;
    border: 2px solid var(--primary-color);
}

.install-prompt.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

.install-prompt-content p {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.install-prompt-content p:last-of-type {
    font-size: 14px;
    color: var(--text-secondary);
}

.install-prompt-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.install-prompt-buttons .btn {
    flex: 1;
    max-width: 150px;
}

@media (max-width: 480px) {
    .install-prompt {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 16px;
    }
    
    .install-prompt-buttons {
        flex-direction: column;
    }
    
    .install-prompt-buttons .btn {
        max-width: 100%;
    }
}
