/* ============================================
   GLOBALV3.CSS - PHAROS CMS Admin Styles
   ============================================

   Table of Contents:
   1. CSS Variables
   2. Base & Global Styles
   3. Layout Components
   4. Buttons
   5. Form Controls
   6. Tabs Component
   7. Wizard/Stepper Component
   8. Case Components
   9. Client Components
   10. Status Badges
   11. Info & Alert Boxes
   12. Third-Party Overrides
   13. Utilities
   ============================================ */


/* ============================================
   1. CSS VARIABLES
   ============================================ */
:root {
    /* Primary Color Palette */
    --bg-primary: #121217;
    --bg-secondary: #1E1E28;
    --bg-card: #1E1E28;
    --bg-elevated: #2a2a35;
    --accent-primary: #00CED1;
    --accent-secondary: #FFD700;
    --text-primary: #E0E0E0;
    --text-muted: #A0A0A0;
    --primary-rgb: 0, 206, 209;
    --secondary-rgb: 255, 15, 0;

    /* Status Colors */
    --status-new: #ADD8E6;
    --status-assigned: #87CEEB;
    --status-progress: #3CB371;
    --status-hold: #FF6347;
    --status-closed: #696969;

    /* Spacing System */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Layout Variables */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;
    --transition-speed: 0.3s;
    --border-color: rgba(255, 255, 255, 0.1);

    /* Legacy Colors (backwards compatibility) */
    --white: #FFFFFF;
    --black: #000000;
    --grey: #CCCCCC;
    --light-grey: #F5F5F5;
    --dark-grey: #666666;

    /* Brand Colors */
    --blue: #00CED1;
    --dark-blue: #0099A3;
    --light-blue: #23CCEF;

    /* Semantic Colors */
    --green: #87CB16;
    --orange: #FFA534;
    --red: #FB404B;
    --dark-red: #D32F2F;
    --purple: #AA43FF;
    --pink: #FA3EF7;
    --teal: #1ABC9C;
    --wine: #722F37;
    --dark-yellow: #FFC107;
}


/* ============================================
   2. BASE & GLOBAL STYLES
   ============================================ */

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00B8BB;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(var(--primary-rgb), 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Loading State */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--dark-grey);
}

.loading::after {
    content: "...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

.text-red {
    color: var(--red);
}
.text-yellow {
    color: var(--dark-yellow);
}
.text-green {
    color: var(--green);
}
.text-blue {
    color: var(--blue);
}


/* ============================================
   3. LAYOUT COMPONENTS
   ============================================ */

/* Page Header */
.page-header {
    margin-bottom: 20px;
}

/* Icons */
.material-icons.reversed {
    transform: rotate(180deg);
}
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header.underlined {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.2);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Action Area */
.action-area {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--accent-primary);
    text-decoration: none;
    margin-bottom: var(--spacing-lg);
    font-weight: 500;
    transition: all var(--transition-speed);
}

.back-link:hover {
    gap: var(--spacing-md);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--bg-primary);
    border: 1px solid rgba(var(--primary-rgb) 0.3);
    border-radius: var(--border-radius-xs);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--accent-primary);
}


/* ============================================
   4. BUTTONS
   ============================================ */

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
    background-color: transparent;
}

.btn-primary:hover {
    background: rgba(var(--primary-rgb), 0.2);
}

.btn-secondary {
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-weight: 500;
    background-color: transparent;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: var(--green);
    color: white;
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-warning {
    background: var(--orange);
    color: white;
}

.btn-audit {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.btn-audit:hover {
    background: #00B8BB;
}

/* Button Sizes */
.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
}

.btn-xs {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Icon Buttons */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    padding: 0.25rem 0.25rem 0;
    opacity: 0.7;
    transition: opacity var(--transition-speed);
    color: var(--text-muted);
}

.btn-icon:hover {
    opacity: 1;
}

.btn-icon.btn-success {
    color: var(--green);
    background: transparent;
}

.btn-icon.btn-success:hover {
    background: rgba(135, 203, 22, 0.2);
}

.btn-icon.btn-danger {
    color: var(--red);
    background: transparent;
}

.btn-icon.btn-danger:hover {
    background: rgba(251, 64, 75, 0.2);
}

.btn-icon.btn-warning {
    color: var(--orange);
    background: transparent;
}

.btn-icon.btn-warning:hover {
    background: rgba(255, 165, 52, 0.2);
}

/* Add Client Button */
.add-client-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 10px 18px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: var(--border-radius);
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    width: fit-content;
}

.add-client-btn:hover {
    background: rgba(var(--primary-rgb), 0.2);
}

/* Change Button */
.change-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.change-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}


/* ============================================
   5. FORM CONTROLS
   ============================================ */

/* Form Group */
.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    width: 100%;
}

/* Form Control (legacy) */
.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Form Inputs */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-speed);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

.form-input.input-error,
.form-select.input-error,
.form-textarea.input-error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

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

.form-textarea.large {
    min-height: 180px;
}

/* Form Label */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.required {
    color: #ef4444;
    margin-left: 3px;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9375rem;
}

.radio-label input[type="radio"] {
    cursor: pointer;
}


/* ============================================
   6. TABS COMPONENT
   ============================================ */

.tabs-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 30px;
}

.tabs-nav {
    display: flex;
    background: var(--bg-primary);
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.2);
    overflow-x: auto;
}

.tabs-header {
    display: flex;
    background: var(--bg-card);
    border-bottom: 2px solid var(--bg-primary);
}

/* Tab Link */
.tab-link {
    padding: var(--spacing-md) var(--spacing-lg);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-speed);
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.tab-link:hover {
    color: var(--text-primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.tab-link.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(var(--primary-rgb), 0.1);
}

/* Tab Button */
.tab-button {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tab-button:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--accent-primary);
    background: var(--bg-elevated);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

/* Tab Icon & Badge */
.tab-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.tab-badge {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tab-badge.optional {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--accent-primary);
}

.tab-badge.required {
    background: #fef3c7;
    color: #92400e;
}

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

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

.tab-header-info {
    margin-bottom: 30px;
}

.tab-header-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tab-header-info p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}


/* ============================================
   7. WIZARD / STEPPER COMPONENT
   ============================================ */

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.step {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.step-number {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    transition: all var(--transition-speed);
}

.step.active .step-number {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #00a8aa 100%);
    color: var(--bg-primary);
}

.step.completed .step-number {
    background: var(--status-progress);
    color: var(--bg-primary);
}

.step-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all var(--transition-speed);
}

.step.active .step-label {
    color: var(--accent-primary);
}

.step.completed .step-label {
    color: var(--status-progress);
}

.step-divider {
    width: 60px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
}


/* ============================================
   8. CASE COMPONENTS
   ============================================ */

/* Case Info Panel */
.case-info-panel {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.case-title-section h2 {
    font-size: 24px;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.case-number {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

.case-badges {
    display: flex;
    gap: 8px;
}

/* Case Details Grid */
.case-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-value {
    font-size: 15px;
    color: #ffffff;
    font-weight: 500;
}


/* ============================================
   9. CLIENT COMPONENTS
   ============================================ */

/* Client Search */
.client-search {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: var(--border-radius);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-speed);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(var(--primary-rgb), 0.1);
}

.result-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.result-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Selected Client Card */
.selected-client-card {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    display: none;
    margin-top: var(--spacing-md);
}

.selected-client-card.visible {
    display: block;
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.client-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.client-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 0.85rem;
}

.client-detail {
    color: rgba(255, 255, 255, 0.7);
}

.client-detail strong {
    color: rgba(255, 255, 255, 0.9);
}


/* ============================================
   10. STATUS BADGES
   ============================================ */

.status-badge.in-progress {
    background: var(--status-progress);
    color: white;
}

.status-badge.pending {
    background: var(--orange);
    color: white;
}

.status-badge.approved {
    background: var(--green);
    color: white;
}

.status-badge.completed {
    background: var(--blue);
    color: white;
}

.status-badge.active {
    background: var(--green);
    color: white;
}


/* ============================================
   11. INFO & ALERT BOXES
   ============================================ */

.info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.info-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
}

.info-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.info-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}


/* ============================================
   12. THIRD-PARTY OVERRIDES
   ============================================ */

/* intlTelInput Dark Theme */
.iti {
    width: 100%;
}

.iti__country-container {
    background: var(--bg-elevated);
    border-radius: var(--border-radius-xs) 0 0 var(--border-radius-xs);
}

.iti__selected-country {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-xs) 0 0 var(--border-radius-xs);
}

.iti__selected-country:hover {
    background: rgba(255, 255, 255, 0.1);
}

.iti__dropdown-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xs);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.iti__search-input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
}

.iti__search-input::placeholder {
    color: var(--text-muted);
}

.iti__country {
    padding: 8px 12px;
    color: var(--text-primary);
}

.iti__country:hover,
.iti__country--highlight {
    background: rgba(var(--primary-rgb), 0.2);
}

.iti__dial-code {
    color: var(--text-muted);
}

.iti__country-name {
    color: var(--text-primary);
}

.iti input.form-input {
    padding-left: 52px;
}


/* ============================================
   13. UTILITIES
   ============================================ */

.truncate-text {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
