@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #f3f4f6; /* Modern light-gray background */
    --panel-bg: #ffffff;
    --panel-border: #e2e8f0;
    --accent: #e11d48; /* Red-pink (mockup style) */
    --accent-hover: #be123c;
    --accent-glow: rgba(225, 29, 72, 0.08);
    --accent-light: rgba(225, 29, 72, 0.04);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* App Layout */
.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 250px;
    background: var(--panel-bg);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 28px;
    padding: 10px 0;
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-menu-item a:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.sidebar-menu-item.active a {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--panel-border);
    padding-top: 16px;
    margin-top: auto;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 250px;
    padding: 30px;
    max-width: 100%;
    transition: var(--transition);
}

/* Mobile Header / Navbar */
.mobile-navbar {
    display: none;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-border);
    padding: 12px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 90;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.mobile-logo img {
    height: 36px;
    object-fit: contain;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 80px 16px 40px 16px;
    }
    .mobile-navbar {
        display: flex;
    }
}

/* Container cards (used in light mode) */
.glass-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.glass-card {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    position: relative;
    overflow: visible;
}

/* Portal Header red/pink redesign */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.portal-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portal-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portal-breadcrumbs {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.portal-breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
}

.portal-user-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--panel-border);
    padding: 6px 14px 6px 6px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.portal-user-widget:hover {
    background: #f8fafc;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.user-info-text {
    display: flex;
    flex-direction: column;
}

.user-name-line {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.user-dropdown-arrow {
    color: var(--text-secondary);
}

/* Metadata summary cards */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metadata-card {
    background: #ffffff;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.metadata-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.metadata-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(225, 29, 72, 0.08); /* light pink */
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metadata-content {
    display: flex;
    flex-direction: column;
}

.metadata-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metadata-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-status-draft {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status-prep {
    color: #d97706;
    background: rgba(217, 119, 6, 0.08);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Forms and Layout Redesign */
.form-section {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    background: #ffffff;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-left: 3px solid var(--accent);
    padding-left: 10px;
    line-height: 1;
}

.form-section-grid {
    display: grid;
    gap: 20px;
}

.form-section-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-section-grid.col-2-unequal {
    grid-template-columns: 1.2fr 0.8fr;
}

@media (max-width: 768px) {
    .metadata-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-section-grid.col-2, .form-section-grid.col-2-unequal {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .metadata-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: none;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #f8fafc;
    border-color: #e2e8f0;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 36px;
}

/* Live Calculations Widget */
.calc-widget {
    background: #f8fafc;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--panel-border);
}

.calc-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--panel-border);
}

.calc-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.calc-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calc-value.highlight {
    font-size: 1.15rem;
    color: var(--accent);
}

/* Report History Items */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-card {
    background: #ffffff;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: var(--transition);
}

.report-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.report-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.report-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.report-card-item {
    font-size: 0.8rem;
}

.report-card-label {
    color: var(--text-muted);
    margin-bottom: 2px;
}

.report-card-val {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Progress Bars */
.progress-container {
    margin-top: 10px;
}

.progress-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.675rem;
    color: var(--text-muted);
}

.stage-labels span.active {
    color: var(--text-primary);
    font-weight: 600;
}

.bar-new { width: 25%; background: #3b82f6; }
.bar-prep { width: 50%; background: #f59e0b; }
.bar-approved { width: 75%; background: #06b6d4; }
.bar-success { width: 100%; background: #10b981; }
.bar-fail { width: 100%; background: #ef4444; }

.text-new { color: #3b82f6; }
.text-prep { color: #f59e0b; }
.text-approved { color: #06b6d4; }
.text-success { color: #10b981; }
.text-fail { color: #ef4444; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-new { background: rgba(59, 130, 246, 0.08); color: #3b82f6; }
.badge-prep { background: rgba(245, 158, 11, 0.08); color: #f59e0b; }
.badge-approved { background: rgba(6, 182, 212, 0.08); color: #06b6d4; }
.badge-success { background: rgba(16, 185, 129, 0.08); color: #10b981; }
.badge-fail { background: rgba(239, 68, 68, 0.08); color: #ef4444; }

/* Login Form Page overrides */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-primary);
    padding: 16px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo img {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
}

/* Admin top banner */
.admin-bar {
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.875rem;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--warning);
}

.admin-badge {
    background: rgba(245, 158, 11, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    animation: slideIn 0.2s ease-out;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.1);
    color: var(--success);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

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

/* Sidebar Backdrop on mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(2px);
    z-index: 95;
}

.sidebar-backdrop.active {
    display: block;
}

/* Media Upload Form Styles */
.media-upload-section {
    margin-top: 15px;
}

.upload-dropzone {
    border: 2px dashed #f472b6; /* Pink-pink dashed border */
    background: #fffdfd;
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-cloud-icon {
    color: var(--accent);
    margin: 0 auto 12px auto;
}

.upload-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-upload-action {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.btn-upload-action:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
}

.preview-item img, .preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item-video-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    padding: 2px 4px;
    font-size: 0.625rem;
    border-radius: 2px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.preview-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: var(--transition);
    z-index: 2;
}

.preview-delete-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* History Media List */
.history-media-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    grid-column: span 2;
}

.history-media-item {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #cbd5e1;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    background: #f1f5f9;
}

.history-media-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.history-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-media-item-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Suffixes inside input fields */
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-suffix .form-control {
    padding-right: 45px;
}

.input-suffix {
    position: absolute;
    right: 1px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
    background: #f8fafc;
    border-left: 1px solid #cbd5e1;
    height: calc(100% - 2px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Input with icon (like date) */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-icon .form-control {
    padding-right: 40px;
}

.input-icon {
    position: absolute;
    right: 14px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Textarea container and char counter */
.textarea-container {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.text-comment {
    resize: none;
    flex-grow: 1;
    min-height: 150px;
    padding-bottom: 28px !important;
}

.char-counter {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Form footer calculations and buttons */
.form-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--panel-border);
}

.calc-widget-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calc-label-inline {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.calc-value-inline {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.action-buttons-group {
    display: flex;
    gap: 12px;
}

.btn-solid-pink {
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px var(--accent-glow);
    transition: var(--transition);
}

.btn-solid-pink:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 12px var(--accent-glow);
}

.btn-solid-pink:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline-pink {
    background: #ffffff;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-outline-pink:hover {
    background: var(--accent-light);
}

.btn-outline-pink:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Stub Placeholders for Development Tabs */
.stub-container {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stub-icon {
    color: var(--accent);
    margin-bottom: 20px;
    background: var(--accent-glow);
    padding: 16px;
    border-radius: 50%;
}

.stub-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.stub-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .form-footer-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .calc-widget-inline {
        justify-content: space-between;
    }
    .action-buttons-group {
        flex-direction: column;
    }
    .btn-solid-pink, .btn-outline-pink {
        justify-content: center;
    }
}
