/* Brand Section Styles - Modern & Cool Design */
#brand-section {
    position: relative;
    z-index: 2;
    display: none;
    padding-top: 90px;
    width: 100%;
    margin: auto;
    box-sizing: border-box;
}

#brand-section.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#brand-section main {
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

.brand-container {
    width: 100%;
}

/* The form contains all the cards - apply grid here */
#brand-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
}

/* Modern Card Design with Glassmorphism */
.brand-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.brand-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.brand-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(102, 126, 234, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.08);
}

.brand-card:hover::before {
    opacity: 1;
}

/* Card Layout */
/* Row 1: Logos (left) + Colors (right) - side by side */
.brand-card:nth-child(1),
.brand-card:nth-child(2) {
    grid-column: span 1;
}

/* Row 2+: Typography, Brand Voice, Social - full width */
.brand-card:nth-child(3),
.brand-card:nth-child(4),
.brand-card:nth-child(5) {
    grid-column: span 2;
}

.brand-card-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.brand-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    letter-spacing: -0.02em;
}

.brand-card-header p {
    font-size: 13px;
    color: #6b7280;
    margin: 6px 0 0 0;
    line-height: 1.5;
}

/* Card Icons */
.brand-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.brand-card-icon.logos {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.brand-card-icon.colors {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.brand-card-icon.typography {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.brand-card-icon.voice {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.brand-card-icon.social {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

/* Logo Upload Styles */
.logo-upload-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.logo-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logo-item label {
    font-size: 10px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logo-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    min-height: 80px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.logo-preview-container:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.06) 100%);
}

.logo-preview-img {
    max-width: 80px;
    max-height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 11px;
    gap: 4px;
    text-align: center;
}

.logo-placeholder i {
    font-size: 24px;
    color: #667eea;
    opacity: 0.5;
}

.logo-upload-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.logo-upload-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.logo-upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.logo-remove-btn {
    padding: 6px 12px;
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.logo-remove-btn:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* Color Palette Styles - Modern Swatches */
.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.color-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-item label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.color-picker {
    width: 100%;
    height: 70px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: white;
    padding: 0;
    overflow: hidden;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        inset 0 0 0 2px rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.color-picker:hover {
    transform: scale(1.05);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.color-picker input[type="color"] {
    width: 100%;
    height: 100%;
    border: none;
    cursor: pointer;
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 10px;
}

.color-value {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    background: #f9fafb;
    text-align: center;
    color: #4b5563;
}

.color-preview {
    display: none;
}

/* Typography Styles */
.typography-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.typography-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.typography-grid .form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.font-select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.font-select:hover {
    border-color: #667eea;
}

.font-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Brand Voice Styles */
.brand-voice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

#brand-section .form-group {
    margin-bottom: 0;
}

#brand-section .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.brand-voice-select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.brand-voice-select:hover {
    border-color: #667eea;
}

.brand-voice-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#brand-section .form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

#brand-section .form-input:hover {
    border-color: #667eea;
}

#brand-section .form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Social Media Styles - Modern Grid */
.social-handles-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.social-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-input-wrapper label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-input-wrapper label i {
    font-size: 18px;
    opacity: 0.7;
}

.social-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.social-input:hover {
    border-color: #667eea;
}

.social-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Form Actions - Floating Save Button */
.brand-form-actions {
    grid-column: span 2;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 0 0 0;
}

.save-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
}

.save-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.45);
}

.save-btn:active {
    transform: translateY(-1px);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status Messages - Toast Style */
.brand-status-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    z-index: 1000;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

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

.brand-status-message.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    display: block;
}

.brand-status-message.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    display: block;
}

/* Loading State */
.brand-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .social-handles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1000px) {
    #brand-form {
        grid-template-columns: 1fr;
    }
    
    .brand-card:nth-child(1),
    .brand-card:nth-child(2),
    .brand-card:nth-child(3),
    .brand-card:nth-child(4),
    .brand-card:nth-child(5) {
        grid-column: span 1;
    }
    
    .brand-form-actions {
        grid-column: span 1;
    }
    
    .logo-upload-group {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .color-palette-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .social-handles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    #brand-section {
        padding: 70px 16px 16px 16px;
    }
    
    #brand-section main {
        padding: 0;
    }

    .brand-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .logo-upload-group {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .logo-preview-container {
        min-height: 100px;
    }
    
    .color-palette-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .typography-grid {
        grid-template-columns: 1fr;
    }
    
    .brand-voice-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .social-handles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .brand-form-actions {
        flex-direction: column;
    }

    .save-btn {
        width: 100%;
        justify-content: center;
    }
    
    .brand-status-message {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 500px) {
    .color-palette-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .social-handles-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Dark Mode Support
   ========================================== */

body.dark-mode #brand-section {
    background: #0a0a0a;
}

body.dark-mode .brand-card {
    background: #171717;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

body.dark-mode .brand-card::before {
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
}

body.dark-mode .brand-card:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
}

body.dark-mode .brand-card-header h3 {
    color: #f1f1f1;
}

body.dark-mode .brand-card-header p {
    color: #a1a1aa;
}

body.dark-mode .brand-card-icon {
    opacity: 0.9;
}

body.dark-mode .logo-item label,
body.dark-mode .color-item label,
body.dark-mode .typography-grid .form-group label,
body.dark-mode #brand-section .form-group label,
body.dark-mode .social-input-wrapper label {
    color: #d4d4d8;
}

body.dark-mode .logo-preview-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

body.dark-mode .logo-preview-container:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    border-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .logo-placeholder {
    color: #71717a;
}

body.dark-mode .logo-placeholder i {
    color: #667eea;
    opacity: 0.7;
}

body.dark-mode .color-value {
    background: #262626;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

body.dark-mode .color-picker {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

body.dark-mode .font-select,
body.dark-mode .brand-voice-select,
body.dark-mode #brand-section .form-input,
body.dark-mode .social-input {
    background: #262626;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

body.dark-mode .font-select:hover,
body.dark-mode .brand-voice-select:hover,
body.dark-mode #brand-section .form-input:hover,
body.dark-mode .social-input:hover {
    border-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .font-select:focus,
body.dark-mode .brand-voice-select:focus,
body.dark-mode #brand-section .form-input:focus,
body.dark-mode .social-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

body.dark-mode .font-select,
body.dark-mode .brand-voice-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

body.dark-mode .social-input-wrapper label i {
    opacity: 0.8;
}

body.dark-mode .save-btn {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

body.dark-mode .save-btn:hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

body.dark-mode .brand-status-message.success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

body.dark-mode .brand-status-message.error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}
