:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Institute Header */
.institute-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.institute-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-section {
    display: flex;
    align-items: center;
}

.institute-logo {
    height: 70px;
    width: auto;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.institute-info {
    flex: 1;
}

.institute-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.institute-subtitle {
    font-size: 0.9rem;
    margin: 0.25rem 0;
    opacity: 0.95;
    font-weight: 300;
}

.institute-address {
    font-size: 0.85rem;
    margin: 0.25rem 0 0 0;
    opacity: 0.9;
    font-style: italic;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    textdecoration: none;
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-links a:hover {
    background: var(--light);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    border-bottom: 2px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-check-input {
    margin-right: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-block {
    width: 100%;
}

/* Messages/Alerts */
.messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--info-color);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
}

.table tbody tr:hover {
    background: var(--light);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    color: #6b7280;
    font-size: 0.875rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Doctor Cards */
.doctor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.doctor-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.doctor-card:hover {
    transform: translate Y(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.doctor-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.doctor-card .specialization {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.doctor-card .availability {
    padding: 0.5rem;
    background: var(--light);
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Time Slots */
.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.time-slot {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.time-slot:hover {
    border-color: var(--primary-color);
    background: var(--light);
}

.time-slot.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.time-slot.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Login/Landing Pages */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    max-width: 450px;
    width: 100%;
}

.login-card h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 2rem;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--light);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Better focus states for accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus,
.form-control:focus {
    outline: none;
}

/* ==========================
   RESPONSIVE DESIGN - MOBILE FIRST
   ========================== */

/* Small phones (max 380px) */
@media (max-width: 380px) {
    .institute-header {
        padding: 1rem 0;
    }

    .institute-logo {
        height: 50px;
        padding: 6px 8px;
    }

    .institute-name {
        font-size: 1.1rem;
    }

    .institute-subtitle {
        font-size: 0.7rem;
    }

    .institute-address {
        font-size: 0.75rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }

    .card {
        padding: 1rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
}

/* Mobile devices (max 640px) */
@media (max-width: 640px) {
    body {
        font-size: 14px;
    }

    .institute-header {
        padding: 1.25rem 0;
    }

    .institute-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 0 15px;
    }

    .institute-logo {
        height: 60px;
    }

    .institute-name {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    .institute-subtitle {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .institute-address {
        font-size: 0.8rem;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .container {
        padding: 15px;
    }

    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .card-header h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.875rem 1.25rem;
        min-height: 44px;
        font-size: 0.95rem;
    }

    .form-control {
        padding: 0.875rem;
        font-size: 16px;
        min-height: 44px;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    .doctor-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .doctor-card {
        padding: 1.25rem;
    }

    .time-slots {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .time-slot {
        padding: 0.625rem;
        font-size: 0.875rem;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .login-card {
        padding: 2.5rem 1.75rem;
    }

    .login-card h2 {
        font-size: 1.5rem;
    }

    .alert {
        font-size: 0.875rem;
        padding: 0.875rem;
    }
}

/* Tablets (641px to 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .institute-logo {
        height: 65px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .doctor-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .time-slots {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape phones */
@media (max-width: 896px) and (orientation: landscape) {
    .institute-header {
        padding: 0.75rem 0;
    }

    .institute-content {
        flex-direction: row;
        gap: 1rem;
    }

    .institute-logo {
        height: 50px;
    }

    .institute-name {
        font-size: 1.25rem;
    }

    .institute-subtitle {
        font-size: 0.75rem;
    }
}

/* General mobile touch optimizations */
@media (max-width: 768px) {
    .btn:hover {
        transform: none;
    }

    .doctor-card:hover {
        transform: none;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .badge {
        padding: 0.3rem 0.65rem;
        font-size: 0.7rem;
    }
}