/* ==========================================================================
   My Weekly Schedule Tool - Zhween Brand Styling
   ========================================================================== */

/* Container fills tool content area */
.tool-content-area .mws-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 1rem;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--bg-secondary, #e8ecef) 0%, var(--bg-accent, #f7fafc) 100%);
    overflow-y: auto;
}

/* Tool-scoped variables (uses design system where possible) */
.mws-container {
    --primary-color: var(--t-primary, #15aebf);
    --primary-light: var(--t-primary-light, #4ecdc4);
    --primary-dark: var(--t-primary-dark, #0e9bb2);
    --accent-color: #ffd93d;
    --success-color: var(--t-success, #00b894);
    --danger-color: var(--t-danger, #e17055);
    --white: var(--t-white, #ffffff);
    --gray-100: var(--t-gray-100, #f1f3f4);
    --gray-200: var(--t-gray-200, #e9ecef);
    --gray-300: var(--t-gray-300, #dee2e6);
    --gray-600: var(--t-gray-600, #6c757d);
    --text-primary: var(--t-text-primary, #2d3748);
    --text-secondary: var(--t-text-secondary, #4a5568);
    --radius-md: var(--t-radius-md, 0.5rem);
    --radius-lg: var(--t-radius-lg, 0.75rem);
    --radius-xl: var(--t-radius-xl, 1rem);
    --radius-2xl: var(--t-radius-2xl, 1.25rem);
    --shadow-md: var(--t-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
    --shadow-lg: var(--t-shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.12));
}

* { box-sizing: border-box; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.mws-app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0.75rem;
}

.mws-header {
    text-align: center;
    flex-shrink: 0;
}

.mws-header h2 {
    font-size: clamp(1.1rem, 3vh, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mws-header h2::before {
    content: '';
    width: 4px;
    height: 1.25rem;
    background: var(--primary-color);
    border-radius: 9999px;
}

/* --------------------------------------------------------------------------
   Controls Section
   -------------------------------------------------------------------------- */

.mws-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.mws-input-group {
    flex: 1;
    min-width: 180px;
}

.mws-input-group label {
    display: block;
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
}

.mws-input-group input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 2px solid rgba(21, 174, 191, 0.35);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    background: var(--white);
}

.mws-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(21, 174, 191, 0.2);
}

/* --------------------------------------------------------------------------
   Button Group
   -------------------------------------------------------------------------- */

.mws-button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.mws-button-group button {
    flex: 1;
    min-width: 120px;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.mws-btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(21, 174, 191, 0.3);
}

.mws-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 174, 191, 0.4);
}

.mws-btn-success {
    background: linear-gradient(135deg, #00a185 0%, var(--success-color) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 184, 148, 0.3);
}

.mws-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.mws-btn-warning {
    background: linear-gradient(135deg, #f5c518 0%, var(--accent-color) 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 14px rgba(255, 217, 61, 0.3);
}

.mws-btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 217, 61, 0.4);
}

.mws-btn-danger {
    background: linear-gradient(135deg, #d04535 0%, var(--danger-color) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(225, 112, 85, 0.3);
}

.mws-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 112, 85, 0.4);
}

/* --------------------------------------------------------------------------
   Loading State
   -------------------------------------------------------------------------- */

.mws-loading {
    display: none;
    text-align: center;
    padding: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.mws-loading.active {
    display: block;
}

/* --------------------------------------------------------------------------
   Schedule Table
   -------------------------------------------------------------------------- */

.mws-schedule-container {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.mws-schedule-header {
    text-align: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: var(--radius-lg);
    color: var(--white);
}

.mws-student-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    word-wrap: break-word;
}

.mws-schedule-title {
    font-size: 0.875rem;
    opacity: 0.95;
}

.mws-table-wrapper {
    flex: 1;
    overflow-x: auto;
}

.mws-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    table-layout: fixed;
}

.mws-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 0.625rem 0.375rem;
    font-size: 0.8125rem;
    text-align: center;
    border: 2px solid var(--white);
    word-wrap: break-word;
}

.mws-table td {
    border: 2px solid var(--gray-300);
    padding: 0.375rem;
    text-align: center;
    min-height: 40px;
    background: var(--white);
    transition: all 0.2s ease;
    vertical-align: middle;
}

.mws-table td:hover {
    background: var(--gray-100);
}

.mws-table td input {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-family: inherit;
}

.mws-table td input:focus {
    outline: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    background: rgba(21, 174, 191, 0.05);
}

/* --------------------------------------------------------------------------
   Delete Row Button
   -------------------------------------------------------------------------- */

.mws-delete-cell {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding: 0.25rem !important;
    background: var(--gray-100) !important;
}

.mws-delete-header {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    background: var(--gray-600) !important;
}

.mws-delete-btn {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    width: 100%;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.mws-delete-btn:hover {
    background: #d04535;
    transform: scale(1.05);
}

.mws-cell-text {
    width: 100%;
    text-align: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.3;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile day abbreviations */
.mws-mobile-day { display: none; }
.mws-desktop-day { display: inline; }

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .mws-container { padding: 0.5rem; }
    .mws-controls { padding: 0.75rem; gap: 0.5rem; }
    .mws-input-group { min-width: 140px; }
    .mws-button-group { flex-direction: column; }
    .mws-button-group button { min-width: 100%; }
    .mws-schedule-container { padding: 0.75rem; }
    .mws-table { font-size: 0.75rem; }
    .mws-table th { padding: 0.5rem 0.25rem; font-size: 0.75rem; }
    .mws-table td input { font-size: 0.75rem; padding: 0.375rem 0.125rem; }
    .mws-mobile-day { display: inline; }
    .mws-desktop-day { display: none; }
    .mws-delete-cell, .mws-delete-header { width: 30px; min-width: 30px; max-width: 30px; }
    .mws-delete-btn { height: 28px; font-size: 0.875rem; }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

@media print {
    .mws-controls, .mws-button-group { display: none !important; }
    .mws-container { box-shadow: none; background: white; }
    .mws-delete-cell, .mws-delete-header { display: none !important; }
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .mws-btn-primary, .mws-btn-success, .mws-btn-warning, .mws-btn-danger,
    .mws-delete-btn, .mws-table td {
        transition: none;
    }
    .mws-btn-primary:hover, .mws-btn-success:hover, .mws-btn-warning:hover,
    .mws-btn-danger:hover, .mws-delete-btn:hover {
        transform: none;
    }
}

/* Focus states for accessibility */
.mws-container *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.mws-container *:focus:not(:focus-visible) {
    outline: none;
}
