/* Main Stylesheet - SwimSwam */

/* CSS Variables */
:root {
    /* Theme Colors (neutral defaults) */
    --primary-color: #000000;
    --text-color: #666666;
    --accent-color: #000000;
    
    /* Backward compatibility with old variable names */
    --primary-red: #000000;
    --primary-black: #000000;
    --text-blue: #666666;
    
    /* Derived theme colors (calculated by theme-manager.js) */
    --primary-color-dark: #000000;
    --primary-color-darker: #000000;
    --primary-color-light: #262626;
    --text-color-dark: #4d4d4d;
    --text-color-light: #808080;
    
    /* Neutral Colors */
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --medium-gray: #cccccc;
    --dark-gray: #666666;
    
    /* Status Colors */
    --success-green: #28a745;
    --warning-orange: #ffc107;
    --error-red: #dc3545;
    
    /* Layout */
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--primary-black);
    background-color: var(--light-gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

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

.btn-primary:focus:not(:focus-visible) {
    outline: none;
}

.btn-secondary {
    background-color: var(--text-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--text-color-dark);
    transform: translateY(-2px);
}

.btn-secondary:focus:not(:focus-visible) {
    outline: none;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

.btn-outline:focus:not(:focus-visible) {
    outline: none;
}

.btn-full {
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    border-bottom: 2px solid var(--light-gray);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label:not(.checkbox-label) {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* Navigation */
.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-blue);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--light-gray);
    margin-bottom: 2rem;
}

.tab {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-blue);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.tab:hover,
.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Status Indicators */
.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-success {
    background-color: #d4edda;
    color: var(--success-green);
}

.status-warning {
    background-color: #fff3cd;
    color: var(--warning-orange);
}

.status-error {
    background-color: #f8d7da;
    color: var(--error-red);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Team Logo Styles */
.team-logo {
    max-height: 50px;
    max-width: 200px;
    height: auto;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.logo .team-logo {
    margin-right: 0.5rem;
}

/* Theme Customization Styles */
.theme-section {
    border-top: 2px solid var(--light-gray);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.color-customization {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.color-picker-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-picker-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.color-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    cursor: pointer;
    padding: 2px;
    background: none;
}

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

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
}

.color-hex-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.color-preview {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.preview-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.preview-swatches {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.preview-swatch {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    border: 2px solid var(--medium-gray);
    box-shadow: var(--box-shadow);
}

/* Logo Upload Styles */
.logo-section {
    border-top: 2px solid var(--light-gray);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.logo-upload-wrapper {
    margin-top: 1rem;
}

.logo-file-input {
    display: none;
}

.logo-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 24px;
    background-color: var(--light-gray);
    border: 2px dashed var(--medium-gray);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--text-color);
}

.logo-upload-label:hover {
    background-color: var(--white);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.upload-icon {
    font-size: 1.2rem;
}

.logo-preview-container {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
}

.logo-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.logo-preview-image {
    max-height: 100px;
    max-width: 200px;
    height: auto;
    width: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    border: 2px solid var(--medium-gray);
    background-color: var(--white);
    padding: 0.5rem;
}

.logo-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--error-red);
    color: var(--white);
    border: 2px solid var(--white);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
}

.logo-remove-btn:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

.logo-preview-text {
    display: block;
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 0.5rem;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Mobile-first: centered at top */
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 40px);
    max-width: 400px;
}

.toast {
    min-width: 280px;
    max-width: 100%;
    padding: 14px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    word-wrap: break-word;
    overflow-wrap: break-word;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-show {
    opacity: 1;
    transform: translateY(0);
}

.toast-hide {
    opacity: 0;
    transform: translateY(-20px);
}

/* Toast Type Colors */
.toast-success {
    background-color: #28a745;
}

.toast-error {
    background-color: #dc3545;
}

.toast-info {
    background-color: #2196F3;
}

.toast-warning {
    background-color: #ffc107;
    color: #333;
}

/* Desktop: Top-right positioning */
@media (min-width: 768px) {
    .toast-container {
        left: auto;
        right: 20px;
        transform: none;
        width: auto;
        max-width: min(400px, calc(100vw - 40px));
    }

    .toast {
        transform: translateX(100%);
    }

    .toast-show {
        transform: translateX(0);
    }

    .toast-hide {
        transform: translateX(100%);
    }
}

/* Ensure toasts stay within viewport on very small screens */
@media (max-width: 320px) {
    .toast-container {
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        transform: none;
    }
}
