/* ========================================
   UI-KIT - Design System
   Based on Figma Design
   ======================================== */

/* ========================================
   CSS Variables - Design Tokens
   ======================================== */
:root {
    /* Colors */
    --color-primary: #28AC75;
    --color-primary-light: rgba(40, 172, 117, 0.24);
    --color-primary-shadow: rgba(40, 172, 117, 0.08);
    --color-primary-shadow-strong: rgba(40, 172, 117, 0.16);
    
    --color-background: #F5F7FA;
    --color-white: #FFFFFF;
    --color-dark: #1E2025;
    --color-text-primary: #222222;
    --color-text-secondary: #434A53;
    --color-text-muted: #AAB2BD;
    --color-text-light: #CCD1D9;
    
    --color-border: #E6E9ED;
    --color-border-dark: #CCD1D9;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-sf: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    
    --line-height-xs: 15px;
    --line-height-sm: 17px;
    --line-height-base: 19px;
    --line-height-lg: 24px;
    --line-height-xl: 29px;
    
    /* Spacing */
    --spacing-xs: 6px;
    --spacing-sm: 10px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;
    --spacing-3xl: 40px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-round: 128px;
    
    /* Shadows */
    --shadow-sm: 0px 16px 32px rgba(40, 172, 117, 0.08);
    --shadow-md: 0px 16px 32px rgba(40, 172, 117, 0.16);
    
    /* Layout */
    --container-max-width: 1440px;
    --content-max-width: 1052px;
    --table-max-width: 1200px;
}

/* ========================================
   Dark Theme Variables
   ======================================== */
body.dark-theme {
    --color-background: #1A1D23;
    --color-white: #23262D;
    --color-dark: #FFFFFF;
    --color-text-primary: #E6E9ED;
    --color-text-secondary: #AAB2BD;
    --color-text-muted: #656D78;
    --color-text-light: #434A53;
    
    --color-border: #2F3339;
    --color-border-dark: #434A53;
    
    --shadow-sm: 0px 16px 32px rgba(0, 0, 0, 0.3);
    --shadow-md: 0px 16px 32px rgba(0, 0, 0, 0.5);
}

/* ========================================
   Global Styles
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-transition: background-color 0.3s ease, color 0.3s ease;
    -moz-transition: background-color 0.3s ease, color 0.3s ease;
    -o-transition: background-color 0.3s ease, color 0.3s ease;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-medium);
    line-height: 1.2;
    margin: 0;
}

h1 { font-size: var(--font-size-xl); line-height: var(--line-height-xl); }
h2 { font-size: var(--font-size-lg); line-height: var(--line-height-lg); }
h3 { font-size: var(--font-size-base); line-height: var(--line-height-base); }

.text-xs { font-size: var(--font-size-xs); line-height: var(--line-height-xs); }
.text-sm { font-size: var(--font-size-sm); line-height: var(--line-height-sm); }
.text-base { font-size: var(--font-size-base); line-height: var(--line-height-base); }
.text-lg { font-size: var(--font-size-lg); line-height: var(--line-height-lg); }
.text-xl { font-size: var(--font-size-xl); line-height: var(--line-height-xl); }

.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-secondary { color: var(--color-text-secondary); }

.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-xl);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    font-weight: var(--font-weight-normal);
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-round);
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 180px;
    height: 56px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.btn:hover {
    -webkit-transform: translateY(-2px);
    -moz-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    -o-transform: translateY(-2px);
    transform: translateY(-2px);
    -webkit-box-shadow: var(--shadow-md);
    box-shadow: var(--shadow-md);
}

.btn:active {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #23976a;
}

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

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

.btn-white {
    background: var(--color-white);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-light);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.btn-icon svg,
.btn-icon i {
    width: 20px;
    height: 20px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-lg {
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
}

.card-md {
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-lg);
    margin-bottom: var(--spacing-md);
}

/* ========================================
   Copy Button (Universal)
   ======================================== */
.copy-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.copy-btn svg {
    width: 19px;
    height: 18px;
    transition: fill 0.3s ease;
}

.copy-btn:hover {
    opacity: 0.7;
}

.copy-btn:active {
    transform: scale(0.95);
}

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

.form-label {
    display: block;
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 56px;
    padding: 0 var(--spacing-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

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

.form-textarea {
    height: auto;
    min-height: 120px;
    padding: var(--spacing-md);
    resize: vertical;
}

/* Checkbox */
.form-checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* ========================================
   Layout Components
   ======================================== */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.content-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 56px 0;
}

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* ========================================
   Dividers
   ======================================== */
.divider {
    width: 100%;
    height: 0;
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--spacing-lg) 0;
}

.divider-dashed {
    border-top-style: dashed;
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.opacity-50 { opacity: 0.5; }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

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

@media (max-width: 768px) {
    :root {
        --spacing-xl: 20px;
        --spacing-2xl: 24px;
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .content-wrapper {
        padding: 32px 0;
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .btn {
        min-width: 140px;
        height: 48px;
        padding: var(--spacing-sm) var(--spacing-lg);
    }
    
    .card {
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
    }
}
