/* File: frontend/css/style.css */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-color: #dee2e6;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #fff;
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.py-3 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* Header */
.header {
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}
.header-nav a {
    color: var(--dark-color);
    text-decoration: none;
    margin-left: 1rem;
    padding: 0.5rem;
}
.header-nav a:hover, .header-nav a.active {
    color: var(--primary-color);
}
.header-nav .nav-button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
}
.header-nav .nav-button:hover {
    opacity: 0.9;
}

/* Main Content */
h1 {
    color: var(--dark-color);
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}
.search-bar input {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    flex-grow: 1;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

.search-bar input:hover {
    border-color: #adb5bd;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.search-bar input::placeholder {
    color: #adb5bd;
}
.search-bar button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
    white-space: nowrap;
}
.search-bar button:hover {
    background-color: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}
.search-bar button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.filter-bar label {
    margin-right: 0.5rem;
    font-weight: 500;
}

.sort-select {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.sort-select:hover {
    border-color: var(--primary-color);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading state */
[aria-busy="true"] {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

[aria-busy="true"]::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading message */
.loading-message {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
    font-style: italic;
}

/* Error message */
.error {
    color: #dc3545;
    background-color: #f8d7da;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

/* Success message */
.success {
    color: #155724;
    background-color: #d4edda;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

/* Doctor Feed - Modern Design */
.feed-main {
    min-height: calc(100vh - 200px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem 0;
}

.feed-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.feed-header {
    margin-bottom: 2rem;
}

.feed-header-content {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    text-align: center;
}

.feed-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0 0 0.75rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feed-subtitle {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 0;
    font-weight: 400;
}

.feed-search-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.search-bar-modern {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr auto auto;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--secondary-color);
    pointer-events: none;
    z-index: 1;
}

.search-input-group input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.search-select-group {
    position: relative;
}

.search-select-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.search-select-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.btn-search {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
    white-space: nowrap;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

.btn-search:active {
    transform: translateY(0);
}

.btn-clear-modern {
    padding: 0.875rem 1.5rem;
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-clear-modern:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-bar-modern {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.filter-label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.sort-select-modern {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.sort-select-modern:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.feed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--secondary-color);
}

.feed-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.doctor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.doctor-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.doctor-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #0056b3 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.doctor-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.doctor-card:hover::before {
    transform: scaleX(1);
}

.doctor-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

.doctor-card-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, var(--light-color) 0%, #e9ecef 100%);
    border: 2px solid var(--border-color);
}

.doctor-card-photo-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--light-color) 0%, #e9ecef 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 600;
}

.doctor-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1.3;
}

.doctor-card .specialty {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
    width: fit-content;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.doctor-card .address {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.doctor-card .address::before {
    content: '📍';
    font-size: 1rem;
    flex-shrink: 0;
}

.doctor-card .practice {
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--light-color);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.doctor-card .rating {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doctor-card .rating::before {
    content: '⭐';
    font-size: 1.25rem;
}

.doctor-card .rating strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .search-bar-modern {
        grid-template-columns: 1fr 1fr;
    }
    
    .btn-search,
    .btn-clear-modern {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .feed-title {
        font-size: 2rem;
    }
    
    .search-bar-modern {
        grid-template-columns: 1fr;
    }
    
    .btn-search,
    .btn-clear-modern {
        grid-column: span 1;
    }
    
    .doctor-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar-modern {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
}

.notification {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left-color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-warning {
    border-left-color: #ffc107;
}

.notification-info {
    border-left-color: #17a2b8;
}

.notification-icon {
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-success .notification-icon {
    color: #28a745;
}

.notification-error .notification-icon {
    color: #dc3545;
}

.notification-warning .notification-icon {
    color: #ffc107;
}

.notification-info .notification-icon {
    color: #17a2b8;
}

.notification-message {
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-close:hover {
    color: var(--dark-color);
}

/* Dialog (Confirmation) */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1rem;
}

.dialog {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: dialogFadeIn 0.2s ease;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.dialog-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.dialog-close:hover {
    background: var(--light-color);
    color: var(--dark-color);
}

.dialog-body {
    padding: 1.5rem;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn-cancel:hover {
    opacity: 0.9;
}

.btn-cancel:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--light-color);
    color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* NSFW Image Handling */
.doctor-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.nsfw-blur img {
    filter: blur(20px);
    transition: filter 0.3s ease;
}

.nsfw-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.nsfw-blur.revealed .nsfw-overlay {
    opacity: 0;
    pointer-events: none;
}

.nsfw-blur.revealed img {
    filter: blur(0);
}

.nsfw-reveal-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nsfw-reveal-btn:hover {
    opacity: 0.9;
}

.nsfw-reveal-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Search Bar Styles */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-bar input,
.search-bar select {
    flex: 1;
    min-width: 150px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-bar select:hover {
    border-color: #adb5bd;
}

.search-bar select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
    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='%230d6efd' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.btn-clear {
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-clear:hover {
    opacity: 0.9;
}

.btn-clear:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-bar label {
    font-weight: 500;
    white-space: nowrap;
}

.sort-select {
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-select:hover {
    border-color: #adb5bd;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
    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='%230d6efd' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Main Content Area - Should grow to fill space */
main {
    flex: 1;
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto; /* Push to bottom */
}