/**
 * Wi-Fi Credential Management System - Styles
 * Brand Colors:
 * - Primary Yellow: #ffc72c
 * - Teal: #4BB697
 * - Light Background: #F4F6F9
 * - Dark Green: #143B2D
 * - Gray: #545859
 */

/* ============================================================
   CSS RESET & BASE STYLES
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Bahnschrift', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #F4F6F9;
    color: #143B2D;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Century Schoolbook', 'Georgia', 'Times New Roman', serif;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin-bottom: 1em; }

a {
    color: #4BB697;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #143B2D;
    text-decoration: underline;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    padding: 30px 20px;
    min-height: calc(100vh - 70px);
}

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */
.header {
    background-color: #143B2D;
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-logo {
    color: #ffffff;
    font-family: 'Century Schoolbook', serif;
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo svg {
    width: 32px;
    height: 32px;
    fill: #ffc72c;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-nav a {
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.header-nav a:hover {
    background-color: rgba(255,255,255,0.1);
    text-decoration: none;
}

.header-nav a.active {
    background-color: #4BB697;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffffff;
    font-size: 0.9rem;
}

.header-user span {
    opacity: 0.8;
}

.btn-logout {
    background-color: #ffc72c;
    color: #143B2D !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-logout:hover {
    background-color: #e6b327;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #ffc72c;
    color: #143B2D;
}

.btn-primary:hover {
    background-color: #e6b327;
    color: #143B2D;
}

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

.btn-secondary:hover {
    background-color: #3da384;
    color: #ffffff;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c82333;
    color: #ffffff;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #4BB697;
    color: #4BB697;
}

.btn-outline:hover {
    background-color: #4BB697;
    color: #ffffff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #143B2D;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #4BB697;
    box-shadow: 0 0 0 3px rgba(75, 182, 151, 0.2);
}

.form-input::placeholder {
    color: #999;
}

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

.form-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
}

.form-help {
    color: #545859;
    font-size: 0.875rem;
    margin-top: 5px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 25px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0;
}

/* ============================================================
   CREDENTIAL DISPLAY CARD (Special styling for Wi-Fi credentials)
   ============================================================ */
.credential-card {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
    padding: 50px;
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
}

.credential-card .student-name {
    font-family: 'Century Schoolbook', serif;
    font-size: 1.75rem;
    color: #143B2D;
    margin-bottom: 10px;
}

.credential-card .semester-badge {
    display: inline-block;
    background-color: #4BB697;
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 30px;
}

.credential-card .credential-section {
    background-color: #F4F6F9;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.credential-card .credential-label {
    font-size: 0.9rem;
    color: #545859;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.credential-card .credential-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 2rem;
    font-weight: bold;
    color: #143B2D;
    word-break: break-all;
    user-select: all;
}

.credential-card .credential-value.username {
    color: #4BB697;
}

.credential-card .credential-value.password {
    color: #ffc72c;
    background-color: #143B2D;
    padding: 15px 20px;
    border-radius: 8px;
}

.credential-card .back-link {
    margin-top: 30px;
}

/* ============================================================
   SEARCH
   ============================================================ */
.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.search-box .form-input {
    flex: 1;
    font-size: 1.1rem;
    padding: 16px 20px;
}

.search-box .btn {
    padding: 16px 30px;
}

.search-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-filters .form-select {
    width: auto;
    min-width: 180px;
}

/* ============================================================
   RESULTS TABLE / LIST
   ============================================================ */
.results-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.results-table th,
.results-table td {
    padding: 15px 20px;
    text-align: left;
}

.results-table th {
    background-color: #143B2D;
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.results-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.results-table tbody tr:hover {
    background-color: #f8f9fa;
}

.results-table tbody tr:last-child {
    border-bottom: none;
}

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

/* Results as clickable cards */
.result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    padding: 18px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.result-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
}

.result-item .student-info {
    display: flex;
    flex-direction: column;
}

.result-item .student-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #143B2D;
}

.result-item .student-semester {
    font-size: 0.9rem;
    color: #545859;
    margin-top: 4px;
}

.result-item .arrow {
    color: #4BB697;
    font-size: 1.5rem;
}

/* ============================================================
   ADMIN DASHBOARD
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.dashboard-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.dashboard-card .icon.yellow { background-color: #ffc72c; }
.dashboard-card .icon.teal { background-color: #4BB697; color: #fff; }
.dashboard-card .icon.green { background-color: #143B2D; color: #fff; }

.dashboard-card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.dashboard-card p {
    color: #545859;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.2s ease;
    background-color: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #4BB697;
    background-color: rgba(75, 182, 151, 0.05);
}

.upload-area input[type="file"] {
    display: none;
}

.upload-area .upload-icon {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

.upload-area p {
    color: #545859;
    margin-bottom: 15px;
}

/* ============================================================
   PREVIEW TABLE
   ============================================================ */
.preview-container {
    margin-top: 20px;
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.preview-table th,
.preview-table td {
    padding: 10px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

.preview-table th {
    background-color: #143B2D;
    color: #ffffff;
}

.preview-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* ============================================================
   ALERTS & MESSAGES
   ============================================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: rgba(75, 182, 151, 0.15);
    color: #2d8a6e;
    border: 1px solid #4BB697;
}

.alert-error {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid #dc3545;
}

.alert-warning {
    background-color: rgba(255, 199, 44, 0.15);
    color: #856404;
    border: 1px solid #ffc72c;
}

.alert-info {
    background-color: rgba(20, 59, 45, 0.1);
    color: #143B2D;
    border: 1px solid #143B2D;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination a {
    background-color: #ffffff;
    color: #143B2D;
    border: 1px solid #ddd;
}

.pagination a:hover {
    background-color: #4BB697;
    color: #ffffff;
    border-color: #4BB697;
}

.pagination .active {
    background-color: #143B2D;
    color: #ffffff;
    border: 1px solid #143B2D;
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #545859;
    padding: 5px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #545859; }
.text-success { color: #4BB697; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc72c; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden { display: none !important; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-admin { background-color: #ffc72c; color: #143B2D; }
.badge-employee { background-color: #4BB697; color: #ffffff; }
.badge-active { background-color: #4BB697; color: #ffffff; }
.badge-inactive { background-color: #545859; color: #ffffff; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 50px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo svg {
    width: 64px;
    height: 64px;
    fill: #143B2D;
}

.login-logo h1 {
    font-size: 1.5rem;
    margin-top: 15px;
    color: #143B2D;
}

.login-logo p {
    color: #545859;
    font-size: 0.95rem;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        height: auto;
        padding: 15px 20px;
        gap: 10px;
    }
    
    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .header-user {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .credential-card {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .credential-card .credential-value {
        font-size: 1.4rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 12px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px 15px;
    }
    
    .btn {
        padding: 10px 18px;
    }
    
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
}

/* ============================================================
   PRINT STYLES (if ever needed)
   ============================================================ */
@media print {
    .header,
    .btn,
    .search-box,
    .pagination {
        display: none !important;
    }
    
    .credential-card {
        box-shadow: none;
        border: 2px solid #000;
    }
}
