/**
 * Admin Styles - Main Stylesheet
 * Core styling for the Freckled Fairy Admin Dashboard
 * This file contains the primary layout and base component styles
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--secondary-font);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--primary-font);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--text-2xl); margin-bottom: var(--space-5); }
h3 { font-size: var(--text-xl); margin-bottom: var(--space-4); }
h4 { font-size: var(--text-lg); margin-bottom: var(--space-3); }

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

a {
    color: var(--sage-green);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--sage-green-dark);
    text-decoration: underline;
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blush-pink-light) 0%, var(--warm-white) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--space-8);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-strong);
    animation: fadeInUp 0.4s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.brand-title {
    font-size: var(--text-3xl);
    color: var(--deep-moss);
    margin-bottom: var(--space-2);
}

.brand-subtitle {
    font-size: var(--text-lg);
    color: var(--text-muted);
    font-weight: var(--font-normal);
}

.login-form {
    margin-bottom: var(--space-6);
}

.login-footer {
    text-align: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.footer-text {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard-page {
    background-color: var(--bg-secondary);
}

/* Header */
.admin-header {
    background: white;
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand-name {
    font-size: var(--text-2xl);
    color: var(--deep-moss);
    margin: 0;
}

.brand-tag {
    background: var(--sage-green);
    color: white;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-email {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Main Dashboard Area */
.dashboard-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    background: white;
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--secondary-font);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    position: relative;
}

.tab-button:hover {
    background: var(--bg-hover);
    color: var(--sage-green);
}

.tab-button.active {
    background: var(--sage-green);
    color: white;
}

.tab-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.notification-badge {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    background: var(--rose-gold);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* Tab Content */
.tab-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
    min-height: 500px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--border-light);
}

.panel-title {
    font-size: var(--text-2xl);
    color: var(--deep-moss);
    margin: 0;
}

.panel-actions {
    display: flex;
    gap: var(--space-2);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-group label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
}

.filter-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: white;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-base);
}

.filter-select:hover {
    border-color: var(--sage-green);
}

.filter-select:focus {
    outline: none;
    border-color: var(--sage-green);
    box-shadow: 0 0 0 3px rgba(138, 152, 118, 0.2);
}

/* ========================================
   TABLE STYLES
   ======================================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: var(--table-header-bg);
}

.data-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.data-table tbody tr {
    transition: var(--transition-base);
}

.data-table tbody tr:hover {
    background: var(--table-hover-bg);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Empty State */
.table-empty {
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.table-empty p {
    color: var(--text-muted);
    font-size: var(--text-lg);
    margin: 0;
}

/* Table Cell Styles */
.message-excerpt {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
}

.status-badge.status-new {
    background: rgba(138, 152, 118, 0.1);
    color: var(--sage-green);
}

.status-badge.status-responded {
    background: rgba(80, 103, 74, 0.1);
    color: var(--deep-moss);
}

.status-badge.status-pending {
    background: rgba(229, 189, 170, 0.2);
    color: var(--rose-gold);
}

.status-badge.status-paid {
    background: rgba(80, 103, 74, 0.1);
    color: var(--deep-moss);
}

.status-badge.status-confirmed {
    background: rgba(138, 152, 118, 0.1);
    color: var(--sage-green);
}

.status-badge.status-completed {
    background: rgba(80, 103, 74, 0.1);
    color: var(--deep-moss);
}

.status-badge.status-cancelled {
    background: rgba(182, 110, 93, 0.1);
    color: var(--rose-gold);
}

.table-actions {
    display: flex;
    gap: var(--space-2);
}

/* ========================================
   WORKSHOP GRID
   ======================================== */

.workshop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--space-4);
}

.workshop-card {
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: relative;
    transition: var(--transition-base);
}

.workshop-card:hover {
    border-color: var(--sage-green);
    box-shadow: var(--shadow-md);
}

.workshop-card.inactive {
    opacity: 0.6;
    background: var(--bg-tertiary);
}

.workshop-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

.workshop-card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--deep-moss);
    margin: 0;
}

.workshop-card-status {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
}

.workshop-card-status.active {
    background: rgba(80, 103, 74, 0.1);
    color: var(--deep-moss);
}

.workshop-card-status.inactive {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.workshop-card-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

.workshop-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.workshop-detail {
    display: flex;
    flex-direction: column;
}

.workshop-detail-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: var(--space-1);
}

.workshop-detail-value {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.workshop-card-actions {
    display: flex;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-light);
}

.workshop-drag-handle {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    cursor: move;
    color: var(--text-muted);
    opacity: 0;
    transition: var(--transition-base);
}

.workshop-card:hover .workshop-drag-handle {
    opacity: 1;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-max);
}

.loading-spinner {
    text-align: center;
}

.spinner,
.spinner-large {
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

.spinner-large {
    width: 48px;
    height: 48px;
}

.spinner-circle {
    stroke: var(--sage-green);
    stroke-linecap: round;
    stroke-dasharray: 45;
    stroke-dashoffset: 0;
    transform-origin: center;
    animation: dash 1.5s ease-in-out infinite;
}

.loading-text {
    margin-top: var(--space-4);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes dash {
    0% {
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dashoffset: 45;
        transform: rotate(180deg);
    }
    100% {
        stroke-dashoffset: 0;
        transform: rotate(360deg);
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.hidden { display: none !important; }
.visible { display: block !important; }