/* ============================================
   Stemmer Annotation Tool - Global Styles
   Polished UI/UX Design
   ============================================ */

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

:root {
    /* Colors */
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fb;
    --text-primary: #1a1d21;
    --text-secondary: #5f6b7a;
    --text-muted: #8b95a5;
    --accent-primary: #e65100;
    --accent-secondary: #ff9800;
    --accent-gradient: linear-gradient(135deg, #ff9800 0%, #e65100 100%);
    --success: #00b894;
    --success-light: rgba(0, 184, 148, 0.1);
    --warning: #f0932b;
    --warning-light: rgba(240, 147, 43, 0.1);
    --danger: #d63031;
    --danger-light: rgba(214, 48, 49, 0.08);
    --info: #0984e3;
    --info-light: rgba(9, 132, 227, 0.1);

    /* Borders & Shadows */
    --border-color: #e2e6ea;
    --border-light: #eef0f3;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-focus: 0 0 0 3px rgba(230, 81, 0, 0.12);

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

    /* Border Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: #d0d5da;
}

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

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

.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(214, 48, 49, 0.3);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    gap: 0.3rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
    font-size: 1.1rem;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--accent-primary);
    background: rgba(230, 81, 0, 0.06);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus);
}

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

/* ============================================
   Login Page
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

.login-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl) var(--spacing-xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-icon {
    font-size: 2.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-md);
    display: block;
}

.login-header h1 {
    margin-bottom: 0.4rem;
    font-size: 1.4rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.login-form .btn {
    width: 100%;
    margin-top: var(--spacing-sm);
    padding: 0.75rem;
}

.login-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.error-message {
    background: var(--danger-light);
    color: var(--danger);
    padding: 0.65rem var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    font-size: 0.85rem;
    border: 1px solid rgba(214, 48, 49, 0.15);
}

/* ============================================
   App Header
   ============================================ */
.app-header {
    background: var(--bg-secondary);
    padding: 0.65rem var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 56px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-icon {
    font-size: 1.3rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-left h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 120px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: var(--spacing-md);
    border-left: 1px solid var(--border-light);
}

.user-info > span {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
    margin-top: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   Modal
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-lg);
    backdrop-filter: blur(3px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 950px;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}

.modal-body {
    padding: var(--spacing-xl);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--spacing-md) var(--spacing-xl);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    background: var(--bg-tertiary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem var(--spacing-md);
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .progress-bar-container {
        width: 80px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
}
