/* Base Styles, Forms, and Buttons */

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; }
h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; }
.hidden { display: none; }

/* Card Layout */
.card {
    background: var(--light-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--light-border);
}
.card h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 1px solid var(--light-border);
    padding-bottom: 10px;
}
.row { display: flex; gap: 20px; flex-wrap: wrap; }
.col { flex: 1; min-width: 300px; }

/* Form Elements */
label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 0.9em; font-weight: 500; }
input, select { padding: 12px 16px; border: 1px solid var(--light-border); border-radius: 10px; font-size: 14px; transition: all 0.2s; }
input { width: 100%; margin-bottom: 12px; background: var(--light-bg); }
button { font-family: inherit; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(119,95,255,0.15); }

/* ==========================================
   UNIFIED BUTTON SYSTEM
   ========================================== */

/* Base Button - all buttons inherit from this */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    vertical-align: middle;
    box-sizing: border-box;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(119,95,255,0.2);
}

/* Primary Button - main actions */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
}
.btn-primary:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Secondary Button - outline/ghost style */
.btn-secondary {
    background: var(--light-card);
    color: var(--text-primary);
    border: 1px solid var(--light-border);
}
.btn-secondary:hover {
    background: var(--light-bg);
    border-color: var(--primary-light);
    transform: none;
    box-shadow: none;
}

/* Outline Button - primary color outline */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: rgba(119,95,255,0.08);
    box-shadow: none;
}

/* Danger Button - destructive actions */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%);
    color: white;
    border: none;
}
.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

/* Success Button - positive actions */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%);
    color: white;
    border: none;
}
.btn-success:hover {
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

/* Ghost Button - minimal/text style */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 12px;
}
.btn-ghost:hover {
    background: var(--light-bg);
    color: var(--text-primary);
    transform: none;
}

/* Icon Button - square, icon-only */
.btn-icon {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 8px;
    background: var(--light-card);
    color: var(--text-secondary);
    border: 1px solid var(--light-border);
}
.btn-icon:hover {
    background: var(--light-bg);
    color: var(--primary);
    border-color: var(--primary-light);
    transform: none;
}

/* Small Button */
.btn-sm {
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
    gap: 4px;
    height: 30px;
    box-sizing: border-box;
}
.btn-sm.btn-icon {
    padding: 0;
    min-width: 30px;
    min-height: 30px;
    height: 30px;
}

/* Extra Small Button */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 5px;
    gap: 3px;
}

/* Link-style Button */
.btn-link {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 12px;
    box-shadow: none;
    text-decoration: none;
}
.btn-link:hover {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
    transform: none;
    text-decoration: underline;
}
.btn-link:focus {
    box-shadow: none;
}

/* ==========================================
   UNIFIED DROPDOWN/SELECT SYSTEM
   ========================================== */

.select-dropdown {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    padding-right: 36px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--light-border);
    border-radius: 8px;
    background: var(--light-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 120px;
    max-width: 280px;
    width: auto;
    height: 38px;
    box-sizing: border-box;
    vertical-align: middle;
}
.select-dropdown:hover {
    border-color: var(--primary-light);
}
.select-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(119,95,255,0.15);
}
.select-dropdown option {
    padding: 8px;
}

/* Small Dropdown - matches btn-sm height */
.select-dropdown-sm {
    padding: 0 10px;
    padding-right: 28px;
    font-size: 12px;
    border-radius: 6px;
    background-position: right 6px center;
    background-size: 12px;
    min-width: 80px;
    height: 30px;
    box-sizing: border-box;
    vertical-align: middle;
}

/* ==========================================
   LEGACY BUTTON STYLES (for backwards compatibility)
   ========================================== */
button {
    background: var(--dark-navy);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 5px;
    font-weight: 500;
    border-radius: 8px;
    padding: 10px 20px;
}
button:hover {
    background: #1a1a4b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,11,66,0.3);
}
button:active { transform: translateY(0); }
button:disabled { background: var(--text-muted); cursor: not-allowed; transform: none; box-shadow: none; }
button.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
button.primary:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
}
button.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--light-border);
}
button.secondary:hover {
    background: var(--light-bg);
    border-color: var(--primary-light);
    box-shadow: none;
    transform: none;
}
button.outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
button.outline:hover {
    background: rgba(119,95,255,0.1);
    box-shadow: none;
}
button.danger { background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%); }
button.small { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.download-btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; font-size: 0.85em; background: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%); }

/* ========== Dark Mode Overrides ========== */
/* Dropdown arrow needs lighter color in dark mode */
:root.dark-mode .select-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b8b4cc' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Input and select text color in dark mode */
:root.dark-mode input,
:root.dark-mode select,
:root.dark-mode textarea {
    color: var(--text-primary);
    background: var(--light-bg);
    border-color: var(--light-border);
}

/* Placeholder text in dark mode */
:root.dark-mode input::placeholder,
:root.dark-mode textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
