/**
 * Main Stylesheet for Cloud Data Collection System
 * GitHub-Inspired Dark Theme with Modern Animations
 * 
 * Educational Notes:
 * - CSS Custom Properties (variables) make theming easy
 * - Flexbox and Grid are used for responsive layouts
 * - Transitions and animations enhance user experience
 */

/* ============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */
:root {
    /* GitHub-Inspired Dark Theme Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-hover: #21262d;
    
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --accent-hover: #388bfd;
    
    --success: #3fb950;
    --success-hover: #56d364;
    
    --border-primary: #30363d;
    --border-hover: #8b949e;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.3);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   HEADER SECTION
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 50px;
    height: 50px;
    color: var(--accent-primary);
    animation: glow 2s ease-in-out infinite alternate;
}

/* Educational Note: This creates a pulsing glow effect on the logo */
@keyframes glow {
    from {
        filter: drop-shadow(0 0 5px var(--accent-primary));
    }
    to {
        filter: drop-shadow(0 0 20px var(--accent-primary));
    }
}

.logo-circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    animation: drawCircle 2s ease forwards;
}

@keyframes drawCircle {
    to {
        stroke-dashoffset: 0;
    }
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-primary), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ============================================
   INFO BANNER
   ============================================ */
.info-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    animation: fadeIn 0.8s ease;
}

.info-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.info-banner span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   FORM CONTAINER
   ============================================ */
.form-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.8s ease;
}

.form-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ============================================
   FORM STYLES
   ============================================ */
.submission-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.label-icon {
    font-size: 1.1rem;
}

/* Educational Note: Form inputs have hover and focus states for better UX */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-normal);
    outline: none;
}

.form-input:hover {
    border-color: var(--border-hover);
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

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

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

/* ============================================
   SUBMIT BUTTON
   ============================================ */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Educational Note: This creates a ripple effect on button click */
.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-icon {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
}

/* ============================================
   DEVELOPER MODE TOGGLE
   ============================================ */
.developer-mode {
    padding-top: 1rem;
    border-top: 1px solid var(--border-primary);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    transition: all var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.toggle-input:checked + .toggle-slider {
    background: var(--accent-secondary);
    border-color: var(--accent-primary);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: white;
}

.toggle-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   API DISPLAY (EDUCATIONAL FEATURE)
   ============================================ */
.api-display {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    animation: slideDown 0.4s ease;
}

.api-display.hidden {
    display: none;
}

.api-display-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.api-section {
    margin-bottom: 1rem;
}

.api-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.api-code {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--success);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============================================
   SUCCESS MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    max-width: 400px;
    text-align: center;
    animation: scaleIn 0.4s ease;
}

/* Educational Note: SVG animation for the checkmark */
.success-animation {
    margin-bottom: 1.5rem;
}

.checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.checkmark-circle {
    stroke: var(--success);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: drawCheck 0.6s ease forwards;
}

.checkmark-check {
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: drawCheck 0.3s 0.3s ease forwards;
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

.modal-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-btn {
    padding: 0.75rem 2rem;
    background: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.modal-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border-primary);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer p {
    margin: 0;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.admin-link:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .form-container {
        padding: 1.5rem;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
}

