/* =========================
   Global Variables - Modern Dev Theme
========================= */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
:root {
    --bg: #030F0F;
    --bg-secondary: #01203F;

    --btn-bg: #FEFF00;

    --text: #F6F8ED;
    --text-dark: #030F0F;
    --primary: #2B4FFF;
    --primary-strong: #1F4993;
    --secondary: #FEFF00; 
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --ring: rgba(0, 217, 255, 0.3);
    --shadow: 0 10px 30px rgba(0,0,0,.5);
    --glow: 0 0 20px rgba(0, 217, 255, 0.3);
    --radius: 8px;
    --radius-lg: 16px;
    --maxw: 1120px;
}

/* =========================
   Base - Modern Developer Style
========================= */
* {
    font-family: 'Martian Mono', monospace;
}

body {
    background: var(--bg);
    min-height: 100vh;
    font-family: 'Martian Mono', monospace;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    font-weight: 400;
    margin: 0;
}

h1, h2, h3, h4 {
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.025em;
    font-family: 'Inter', sans-serif;
    font-size: 20px;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
}

p {
    color: var(--text);
    line-height: 1.7;
}

/* =========================
   Footer - Modern Developer Style
========================= */
.app-footer {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #001a2e 100%);
    border-top: 1px solid rgba(43, 79, 255, 0.2);
    margin-top: auto;
    padding: 3rem 0 1.5rem;
    position: relative;
    overflow: hidden;
}

.app-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.footer-content {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.footer-section h4 {
    color: var(--secondary);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.025em;
}

.footer-section p {
    color: rgba(246, 248, 237, 0.8);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(246, 248, 237, 0.8);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
}

.footer-links a:hover {
    color: var(--secondary);
    transform: translateX(4px);
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--secondary);
    transition: width 0.2s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer-bottom {
    border-top: 1px solid rgba(43, 79, 255, 0.1);
    margin-top: 2rem;
    padding-top: 1.5rem;
}

.footer-copyright {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-copyright p {
    color: rgba(246, 248, 237, 0.6);
    font-size: 13px;
    margin: 0;
}

.footer-brand {
    max-width: 400px;
}

.footer-brand p {
    margin-bottom: 1.5rem;
}

.footer-social {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-social-label {
    color: rgba(246, 248, 237, 0.6);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-right: 1rem;
}

.footer-social-link {
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.footer-social-link:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.footer-social-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
    transition: filter 0.2s ease;
}

.footer-social-link:hover .footer-social-icon {
    filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(45deg);
}

/* =========================
   Sidebar Navigation - Removed
========================= */

/* =========================
   Buttons - Modern & Vibrant
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 400;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: 'Martian Mono', monospace;
}

/* Base Button Component with SVG Background */
.custom-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 12px;
    cursor: pointer;
    font-family: 'Martian Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none !important;
    position: relative;
    white-space: nowrap;
    border: 12px solid transparent;
    border-image-slice: 12 12 12 12;
    background: transparent;
    margin-top: 1rem;
}

/* Outline Button (original button.svg) */
.custom-button-outline {
    color: var(--secondary) !important;
    background: transparent;
    border-image: url('components/button.svg') 12 12 12 12 fill;
}

/* Filled Button (button-fill.svg) */
.custom-button-filled {
    color: var(--text-dark) !important;
    border-image: url('components/button-fill.svg') 12 12 12 12 fill;
}


.custom-button-filled:hover:not(:disabled) {
    color: var(--text) !important;
    border-image: url('components/button-hover.svg') 12 12 12 12 fill;

}

.custom-button-outline:hover:not(:disabled) {
    color: var(--text) !important;
    border-image: url('components/button-hover.svg') 12 12 12 12 fill;
}

.custom-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.custom-button:active:not(:disabled) {
    transform: translateY(0);
}

/* =========================
   Tables - Developer Console Style
========================= */
.devices-table-container {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.devices-table {
    width: 100%;
    border-collapse: collapse;
}

    .devices-table th {
        padding: 1rem 1.25rem;
        text-align: left;
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--primary);
        border-bottom: 1px solid rgba(0, 217, 255, 0.2);
    }

    .devices-table td {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        color: var(--text);
        font-family: 'Martian Mono', monospace;
        font-size: 14px;
    }

    .devices-table tr:hover td {
        background: rgba(0, 217, 255, 0.05);
        color: var(--text);
    }

    .devices-table tr:last-child td {
        border-bottom: none;
    }

.token-box {
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--glow);
    max-width: 800px;
    margin: 3rem auto;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

    .token-box::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.1), transparent);
        transition: left 0.5s ease;
    }

    .token-box:hover::before {
        left: 100%;
    }

    .token-box:hover {
        transform: translateY(-4px);
        box-shadow: 0 20px 40px rgba(0, 217, 255, 0.3);
    }

    .token-box .value {
        font-size: 3.5rem;
        font-weight: 800;
        background: var(--primary);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-bottom: 0.5rem;
        font-family: 'Martian Mono', monospace;
    }

    .token-box .label {
        font-size: 1rem;
        color: var(--text);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: 500;
    }

/* =========================
   Alerts - Modern Status
========================= */
.error-alert, .status-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.info-alert, .status-info {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1), rgba(0, 217, 255, 0.05));
    border: 1px solid rgba(0, 217, 255, 0.3);
    color: var(--primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.status-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    padding: 1rem 1.5rem;
    margin-top: 6rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.page-container {
    max-width: var(--maxw);
    margin: 0 auto;
    box-sizing: border-box;
    margin-top: 4rem;
}

.main {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.arduino-code {
    border: 12px solid transparent;
    border-image: url('components/banner.svg') 14 16 14 16 fill;
    border-image-slice: 14 16 14 16;
    padding: 2.5rem;
    margin: 1rem 0;
    position: relative;
    color: var(--text);
    font-family: 'Martian Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    word-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.arduino-code pre {
    margin: 0;
    padding: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.arduino-code code {
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    display: block;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}


    .arduino-code .keyword {
        color: var(--secondary);
        font-weight: 600;
    }

    .arduino-code .include {
        color: var(--secondary);
        font-weight: 600;
    }

    .arduino-code .comment {
        color: var(--success);
        font-style: italic;
    }

    .arduino-code .string {
        color: var(--warning);
    }

/* Reset full-width sections */
.devices-container,
.upload-container,
.container,
main,
article {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0;
    display: block;
}

.upload-container-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: calc(100vh - 4rem);
    padding: 2rem;
}

/* =========================
   Upload Area - Futuristic
========================= */
.upload-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 600px;
    margin: auto;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

    .upload-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--primary);
    }

.file-upload-area {
    border: 2px dashed rgba(0, 217, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    margin: 2rem 0;
    background: rgba(0, 217, 255, 0.02);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

    .file-upload-area:hover {
        border-color: var(--primary);
        background: rgba(0, 217, 255, 0.08);
        box-shadow: inset 0 0 20px rgba(0, 217, 255, 0.1);
    }

.selected-file {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    color: #6ee7b7;
    font-weight: 400;
    font-family: 'Martian Mono', monospace;
    font-size: 14px;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 12px solid transparent;
    border-image: url('components/button.svg') 12 12 12 12 fill;
    border-image-slice: 12 12 12 12;
    background: transparent;
    padding-inline: 12px;
    cursor: pointer;
    font-family: 'Martian Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    color: #FEFF00;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

    .upload-button:hover:not(:disabled) {
        transform: translateY(-1px);
        filter: brightness(1.1);
    }

    .upload-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

    .upload-button:active:not(:disabled) {
        transform: translateY(0);
    }

/* =========================
   Animations - Enhanced
========================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
    }
}

/* =========================
   Mobile Responsive Design
========================= */
@media (max-width: 768px) {
    .app-bar {
        padding-inline: 1rem;
    }
    
    .app-logo {
        height: 3rem;
    }
    
    .page-container {
        margin-top: 3rem;
        padding: 0 1rem;
    }
    
    .main {
        min-height: calc(100vh - 3rem);
    }
    
    /* Typography adjustments */
    h1, h2, h3, h4 {
        font-size: 18px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    h3 {
        font-size: 18px;
    }
    
    /* Button adjustments */
    .custom-button {
        padding: 0.5rem 1rem;
        font-size: 13px;
    }
    
    /* Table responsiveness */
    .devices-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .devices-table {
        min-width: 600px;
    }
    
    .devices-table th,
    .devices-table td {
        padding: 0.75rem 0.5rem;
        font-size: 12px;
    }
    
    /* Token box adjustments */
    .token-box {
        padding: 2rem 1rem;
        margin: 2rem auto;
    }
    
    .token-box .value {
        font-size: 2.5rem;
    }
    
    .token-box .label {
        font-size: 0.875rem;
    }
    
    /* Upload card adjustments */
    .upload-card {
        padding: 2rem 1rem;
        margin: 1rem;
    }
    
    .file-upload-area {
        padding: 2rem 1rem;
    }
    
    /* Arduino code adjustments */
    .arduino-code {
        padding: 1rem;
        font-size: 11px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        box-sizing: border-box;
        text-align: left;
    }
    
    .arduino-code code {
        font-size: 11px;
        line-height: 1.3;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: left;
    }
    
    .arduino-code pre {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: left;
    }
    
    /* Footer adjustments */
    .app-footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 1.5rem;
    }
    
    .footer-section h4 {
        font-size: 16px;
        margin-bottom: 0.75rem;
    }
    
    .footer-links a,
    .footer-section p {
        font-size: 14px;
    }
    
    .footer-links li {
        margin-bottom: 0.5rem;
    }
    
    .footer-brand {
        max-width: none;
        order: 1;
    }
    
    .footer-social {
        justify-content: center;
        margin-top: 1.5rem;
        gap: 1.5rem;
    }
    
    .footer-social-label {
        margin-right: 0;
        margin-bottom: 0.5rem;
        display: block;
        width: 100%;
    }
    
    .footer-social-link {
        margin: 0;
    }
    
    .footer-social-icon {
        width: 28px;
        height: 28px;
    }
    
    .footer-bottom {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
    
    .footer-copyright {
        padding: 0 1rem;
    }
    
    .footer-copyright p {
        font-size: 12px;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .app-bar {
        padding-inline: 0.75rem;
    }
    
    .app-logo {
        height: 2.5rem;
    }
    
    .page-container {
        margin-top: 2.5rem;
        padding: 0 0.75rem;
    }
    
    .main {
        min-height: calc(100vh - 2.5rem);
    }
    
    /* Even smaller typography */
    h1, h2, h3, h4 {
        font-size: 16px;
    }
    
    h2 {
        font-size: 16px;
    }
    
    h3 {
        font-size: 16px;
    }
    
    /* Smaller buttons */
    .custom-button {
        padding: 0.4rem 0.8rem;
        font-size: 12px;
    }
    
    /* Smaller token box */
    .token-box {
        padding: 1.5rem 0.75rem;
        margin: 1.5rem auto;
    }
    
    .token-box .value {
        font-size: 2rem;
    }
    
    .token-box .label {
        font-size: 0.75rem;
    }
    
    /* Smaller upload card */
    .upload-card {
        padding: 1.5rem 0.75rem;
        margin: 0.5rem;
    }
    
    .file-upload-area {
        padding: 1.5rem 0.75rem;
    }
    
    /* Smaller arduino code */
    .arduino-code {
        padding: 0.5rem;
        font-size: 10px;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        box-sizing: border-box;
        text-align: left;
    }
    
    .arduino-code code {
        font-size: 10px;
        line-height: 1.2;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: left;
    }
    
    .arduino-code pre {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        text-align: left;
    }
    
    /* Smaller footer */
    .app-footer {
        padding: 1.5rem 0 0.75rem;
    }
    
    .footer-content {
        padding: 0 0.75rem;
        gap: 1.5rem;
    }
    
    .footer-section {
        margin-bottom: 1rem;
    }
    
    .footer-section h4 {
        font-size: 15px;
        margin-bottom: 0.5rem;
    }
    
    .footer-links a,
    .footer-section p {
        font-size: 13px;
    }
    
    .footer-links li {
        margin-bottom: 0.4rem;
    }
    
    .footer-social {
        margin-top: 1rem;
        gap: 1rem;
    }
    
    .footer-social-icon {
        width: 24px;
        height: 24px;
    }
    
    .footer-bottom {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    .footer-copyright {
        padding: 0 0.75rem;
    }
    
    .footer-copyright p {
        font-size: 11px;
        line-height: 1.3;
    }
}