/**
 * Level Agency Brand Styles
 * Campaign Naming Tool - Branded Version
 */

/* ============================================
   BRAND FOUNDATION
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,700;1,9..40,400&family=Inter+Tight:wght@700;900&display=swap');

:root {
    /* Font Families */
    --font-display: "Inter Tight", sans-serif;
    --font-body: "DM Sans", sans-serif;

    /* Primary Colors */
    --color-white: #FFFFFF;
    --color-black: #000000;
    --color-gray: #D9DEF0;

    /* Secondary Colors (accents) */
    --color-blue: #86D5F4;
    --color-pink: #FD6EF8;
    --color-green: #8EE34D;
    --color-orange: #FFAA53;

    /* Semantic Colors */
    --color-border: #D9DEF0;
    --color-primary: #000000;
    --color-primary-hover: #333333;
    --color-accent: #86D5F4;
    --color-accent-hover: #60C5E8;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

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

/* ============================================
   BASE STYLES
   ============================================ */

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

body {
    font-family: var(--font-body);
    background: #F9FAFB;
    color: var(--color-black);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.2;
}

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

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing);
}

/* ============================================
   HEADER
   ============================================ */

.app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--spacing-xl) var(--spacing);
    background: var(--color-black);
    color: var(--color-white);
    margin-bottom: var(--spacing-lg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.app-header img {
    height: 40px;
    margin-bottom: var(--spacing);
}

.app-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--color-white);
}

.app-header p {
    opacity: 0.8;
    font-size: 0.95rem;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: var(--spacing);
}

.tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-align: center;
    color: var(--color-black);
}

.tab:hover {
    background: #F9FAFB;
}

.tab.active {
    background: var(--color-black);
    color: var(--color-white);
    border-color: var(--color-black);
}

/* ============================================
   PANELS
   ============================================ */

.panel {
    display: none;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.panel.active {
    display: block;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: var(--spacing);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-black);
}

label small {
    font-weight: 400;
    color: #6B7280;
}

select,
input[type="text"],
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(134, 213, 244, 0.15);
}

select:disabled {
    background: #F9FAFB;
    cursor: not-allowed;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.helper-text {
    font-size: 0.8rem;
    color: #6B7280;
    margin-top: 0.375rem;
}

.inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing);
}

/* ============================================
   SEARCHABLE SELECT
   ============================================ */

.search-select-container {
    position: relative;
}

.search-select-input {
    cursor: pointer;
    background: white;
}

.search-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-accent);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.search-select-dropdown.open {
    display: block;
}

.search-select-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-white);
}

.search-select-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.search-select-option {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.search-select-option:hover {
    background: rgba(134, 213, 244, 0.15);
}

.search-select-option.selected {
    background: var(--color-black);
    color: var(--color-white);
}

.search-select-option .code {
    font-weight: 600;
}

.search-select-option .name {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ============================================
   FORMAT GUIDE
   ============================================ */

.format-guide {
    background: rgba(134, 213, 244, 0.15);
    padding: var(--spacing);
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: var(--color-black);
    border-left: 3px solid var(--color-accent);
}

/* ============================================
   PLATFORM NOTE
   ============================================ */

.platform-note {
    display: none;
    margin-top: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: #FFFBEB;
    border-left: 3px solid var(--color-orange);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.875rem;
    color: #92400E;
}

.platform-note.show {
    display: block;
}

/* ============================================
   WILDCARD SECTION
   ============================================ */

.wildcard-section {
    border-top: 2px dashed var(--color-border);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
}

.wildcard-section label {
    color: #6B7280;
}

/* ============================================
   OUTPUT SECTION
   ============================================ */

.output-section {
    margin-top: var(--spacing-lg);
    padding: var(--spacing);
    background: #F9FAFB;
    border-radius: var(--radius);
}

.output-label {
    font-size: 0.75rem;
    color: #6B7280;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.output-name {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1rem;
    padding: var(--spacing);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    word-break: break-all;
    min-height: 50px;
}

.output-name.valid {
    border-color: var(--color-green);
    background: #F0FDF4;
}

.output-name.invalid {
    border-color: #EF4444;
    background: #FEF2F2;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-family: var(--font-display);
    font-weight: 700;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.copy-btn {
    margin-top: var(--spacing);
}

.copy-btn.copied {
    background-color: var(--color-green) !important;
    border-color: var(--color-green) !important;
}

/* ============================================
   VALIDATION RESULTS
   ============================================ */

.validation-results {
    margin-top: var(--spacing);
}

.validation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.validation-item.error {
    background: #FEF2F2;
    color: #B91C1C;
}

.validation-item.success {
    background: #F0FDF4;
    color: #047857;
}

.validation-item.warning {
    background: #FFFBEB;
    color: #B45309;
}

.validation-item.info {
    background: #EFF6FF;
    color: #1D4ED8;
}

.validation-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.name-container {
    margin-bottom: var(--spacing);
}

.name-container .output-name {
    margin-bottom: 0.625rem;
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   GLOSSARY
   ============================================ */

.glossary-section {
    margin-bottom: var(--spacing-lg);
}

.glossary-section h2 {
    font-size: 1.125rem;
    color: var(--color-black);
    margin-bottom: var(--spacing);
    padding-bottom: 0.625rem;
    border-bottom: 2px solid var(--color-black);
}

.glossary-table {
    width: 100%;
    border-collapse: collapse;
}

.glossary-table th {
    text-align: left;
    padding: 0.75rem;
    background: #F9FAFB;
    color: var(--color-black);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.glossary-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.glossary-table tbody tr:hover {
    background: #F9FAFB;
}

.glossary-table .code-cell {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 600;
    color: var(--color-black);
    width: 100px;
}

#glossary-client-search {
    margin-bottom: var(--spacing);
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */

.collapsible-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-top: var(--spacing);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing);
    background: #F9FAFB;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: #F3F4F6;
}

.collapsible-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
}

.result-count {
    font-weight: 400;
    color: #6B7280;
    font-size: 0.85rem;
}

.collapsible-toggle {
    width: 20px;
    height: 20px;
    position: relative;
    flex-shrink: 0;
}

.collapsible-toggle::before,
.collapsible-toggle::after {
    content: '';
    position: absolute;
    background: var(--color-black);
    transition: transform 0.3s ease;
}

.collapsible-toggle::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.collapsible-toggle::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.collapsible-section.expanded .collapsible-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: var(--spacing);
}

.collapsible-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Glossary specific collapsible styles */
.glossary-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.glossary-section.collapsible-section {
    margin-bottom: var(--spacing);
}

/* Validation section specific styles */
#validation-section {
    display: none;
}

#validation-section.has-results {
    display: block;
}

#validation-section .validation-results {
    margin-top: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .inline-fields {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }
}
