/* Waterfront Hospital Clinical Audit App - Branded Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Waterfront Brand Colors */
    --wfh-navy: #102e4a;
    --wfh-navy-dark: #0a1f35;
    --wfh-copper: #c47222;
    --wfh-text: #2a4a6a;
    --wfh-bg: #f0f4f8;
    --wfh-white: #ffffff;

    /* Gradients */
    --wfh-gradient: linear-gradient(135deg, #102e4a 0%, #0a1f35 100%);

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
    background: var(--wfh-bg);
    color: var(--wfh-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--wfh-navy);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--wfh-gradient);
}

.hospital-header {
    text-align: center;
    margin-bottom: 40px;
}

.hospital-logo {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin-bottom: 30px;
}

.hospital-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--wfh-white);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hospital-header h2 {
    font-size: 22px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
}

.login-form {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 420px;
}

.login-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wfh-navy);
}

.staff-select {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border: 2px solid rgba(16, 46, 74, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    appearance: none;
    background-color: var(--wfh-white);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23102e4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    transition: all 0.3s ease;
}

.staff-select:focus {
    outline: none;
    border-color: var(--wfh-copper);
    box-shadow: 0 0 0 3px rgba(196, 114, 34, 0.1);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wfh-white);
    background: var(--wfh-gradient);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 46, 74, 0.2);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 46, 74, 0.3);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled {
    background: rgba(16, 46, 74, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wfh-navy);
    background: var(--wfh-white);
    border: 2px solid var(--wfh-navy);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: var(--wfh-navy);
    color: var(--wfh-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 46, 74, 0.2);
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-secondary {
    background: var(--wfh-white);
    color: var(--wfh-navy);
    border: 2px solid var(--wfh-navy);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--wfh-navy);
    color: var(--wfh-white);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.small-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wfh-text);
    background: var(--wfh-white);
    border: 1px solid rgba(16, 46, 74, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.small-btn:hover {
    border-color: var(--wfh-copper);
    color: var(--wfh-copper);
}

.back-btn {
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wfh-navy);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: var(--wfh-copper);
}

/* Category Cards */
.audit-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--wfh-copper);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-card:hover::before {
    transform: scaleY(1);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(16, 46, 74, 0.15);
}

.category-card h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--wfh-navy);
}

.category-card p {
    color: var(--wfh-text);
    font-size: 15px;
    margin-bottom: 50px;
    line-height: 1.5;
}

.audit-count {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--wfh-copper), #d68a3c);
    color: var(--wfh-white);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(196, 114, 34, 0.3);
}

/* Audit List */
.audit-list-container {
    display: grid;
    gap: 15px;
}

.audit-item {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.audit-item:hover {
    transform: translateX(4px);
    box-shadow: 0 12px 40px rgba(16, 46, 74, 0.15);
}

.audit-item-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--wfh-navy);
}

.audit-item-info p {
    color: var(--wfh-text);
    font-size: 14px;
}

.audit-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background: linear-gradient(135deg, #ffc107, #ffb300);
    color: var(--wfh-white);
}

.status-badge.in-progress {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: var(--wfh-white);
}

.status-badge.completed {
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: var(--wfh-white);
}

.status-badge.overdue {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: var(--wfh-white);
}

.status-badge.due {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: var(--wfh-white);
}

/* Audit Form */
.form-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    max-width: 900px;
    margin: 0 auto 30px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--wfh-navy);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--wfh-copper);
}

.form-group {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(240, 244, 248, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 46, 74, 0.1);
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--wfh-navy);
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--wfh-copper);
    cursor: pointer;
}

.radio-option label {
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
    color: var(--wfh-text);
}

.form-input {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border: 2px solid rgba(16, 46, 74, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    background: var(--wfh-white);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--wfh-copper);
    box-shadow: 0 0 0 3px rgba(196, 114, 34, 0.1);
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

select.form-input {
    cursor: pointer;
}

/* Progress Bar */
.audit-progress {
    margin-bottom: 30px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(16, 46, 74, 0.1);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wfh-copper), #d68a3c);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 20px;
}

#progress-text {
    font-size: 14px;
    color: var(--wfh-text);
    font-weight: 600;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 25px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    bottom: 0;
    border: 1px solid var(--glass-border);
    box-shadow: 0 -4px 20px rgba(16, 46, 74, 0.1);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0 -30px -30px -30px;
}

.bottom-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
    flex-wrap: wrap;
    padding: 0 10px;
}

.bottom-actions button {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
}

/* Dashboard Styles */
.dashboard-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-section {
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(16, 46, 74, 0.15);
}

/* Progress Screen */
.progress-container {
    display: grid;
    gap: 20px;
}

.progress-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 25px;
    background: rgba(16, 46, 74, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(16, 46, 74, 0.1);
}

.stat-value {
    font-size: 42px;
    font-weight: 700;
    background: var(--wfh-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 15px;
    color: var(--wfh-text);
    margin-top: 5px;
    font-weight: 600;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: var(--wfh-text);
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: var(--wfh-white);
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: none;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
    z-index: 9999;
}

.offline-indicator.show {
    display: block;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header h1 {
        font-size: 22px;
    }

    .hospital-header h1 {
        font-size: 28px;
    }

    .hospital-header h2 {
        font-size: 18px;
    }

    .hospital-logo {
        max-width: 240px;
    }

    .login-form {
        padding: 30px 25px;
    }

    .audit-categories {
        grid-template-columns: 1fr;
    }

    .category-card {
        padding: 25px;
        min-height: 140px;
    }

    .category-card p {
        margin-bottom: 55px;
        font-size: 14px;
    }

    .form-container {
        padding: 20px;
        margin-bottom: 20px;
    }

    .form-actions {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        margin: 0 -20px -20px -20px;
    }

    .form-actions button {
        width: 100%;
    }

    .radio-group {
        flex-direction: column;
        gap: 15px;
    }

    .audit-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .audit-status {
        align-items: flex-start;
    }

    .progress-stats {
        grid-template-columns: 1fr;
    }

    .screen {
        padding: 15px;
    }

    .bottom-actions {
        flex-direction: column;
        gap: 12px;
        padding: 0 15px;
    }

    .bottom-actions button {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        padding: 14px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .hospital-header h1 {
        font-size: 24px;
    }

    .hospital-header h2 {
        font-size: 16px;
    }

    .header h1 {
        font-size: 20px;
    }

    .category-card h3 {
        font-size: 20px;
    }

    .form-section h3 {
        font-size: 18px;
    }

    .stat-value {
        font-size: 36px;
    }
}

/* iPad and Tablet Specific */
@media (min-width: 769px) and (max-width: 1024px) {
    .audit-categories {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-container {
        max-width: 100%;
    }
}

/* Touch Device Optimization */
@media (hover: none) and (pointer: coarse) {
    .category-card:hover,
    .audit-item:hover,
    .dashboard-card:hover {
        transform: none;
    }

    .category-card:active,
    .audit-item:active,
    .dashboard-card:active {
        transform: scale(0.98);
    }

    .btn:active,
    .primary-btn:active,
    .secondary-btn:active {
        transform: scale(0.95);
    }
}

/* iOS Specific Styling */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }

    .form-input,
    .staff-select {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Sync Status Indicator */
.sync-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(16, 46, 74, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--wfh-navy);
    z-index: 9998;
    transition: all 0.3s ease;
    max-width: 320px;
}

.sync-status.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.sync-status.syncing {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
}

.sync-status.success {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.sync-status.error {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.sync-status.syncing::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #2196F3;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .sync-status {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Print Styles */
@media print {
    .header .back-btn,
    .form-actions,
    .bottom-actions,
    .sync-status {
        display: none;
    }

    .form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
