/* Material Design 3.0 - Buttons System */

/* === VARIABLES MATERIAL DESIGN 3 - THÈME CLAIR === */
:root {
    /* Primary Colors - Thème clair */
    --md-sys-color-primary: #1976d2;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #e3f2fd;
    --md-sys-color-on-primary-container: #0d47a1;
    
    /* Secondary Colors - Thème clair */
    --md-sys-color-secondary: #455a64;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #eceff1;
    --md-sys-color-on-secondary-container: #263238;
    
    /* Surface Colors - Thème clair */
    --md-sys-color-surface: #ffffff;
    --md-sys-color-on-surface: #212121;
    --md-sys-color-surface-variant: #f5f5f5;
    --md-sys-color-on-surface-variant: #424242;
    --md-sys-color-outline: #9e9e9e;
    --md-sys-color-outline-variant: #e0e0e0;
    
    /* Error Colors */
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;
    
    /* Shape */
    --md-sys-shape-corner-full: 9999px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-none: 0px;
}

/* === BASE BUTTON === */
.md-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.1px;
    text-decoration: none;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    overflow: hidden;
    white-space: nowrap;
    min-height: 40px;
    box-sizing: border-box;
}

.md-button:focus {
    outline: none;
}

.md-button:disabled {
    cursor: not-allowed;
    pointer-events: none;
}

/* State Layer Effect */
.md-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 150ms cubic-bezier(0.2, 0, 0, 1);
}

.md-button:hover::before {
    opacity: 0.08;
}

.md-button:focus::before {
    opacity: 0.12;
}

.md-button:active::before {
    opacity: 0.16;
}

/* === FILLED BUTTON (Primary) === */
.md-button--filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
}

.md-button--filled:hover {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
}

.md-button--filled:disabled {
    background-color: rgba(var(--md-sys-color-on-surface), 0.12);
    color: rgba(var(--md-sys-color-on-surface), 0.38);
    box-shadow: none;
}

/* === TONAL BUTTON === */
.md-button--tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.md-button--tonal:disabled {
    background-color: rgba(var(--md-sys-color-on-surface), 0.12);
    color: rgba(var(--md-sys-color-on-surface), 0.38);
}

/* === OUTLINED BUTTON === */
.md-button--outlined {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
}

.md-button--outlined:disabled {
    color: rgba(var(--md-sys-color-on-surface), 0.38);
    border-color: rgba(var(--md-sys-color-on-surface), 0.12);
}

/* === TEXT BUTTON === */
.md-button--text {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    padding-left: 12px;
    padding-right: 12px;
}

.md-button--text:disabled {
    color: rgba(var(--md-sys-color-on-surface), 0.38);
}

/* === ICON BUTTON === */
.md-icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background-color: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    overflow: hidden;
}

.md-icon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 150ms cubic-bezier(0.2, 0, 0, 1);
}

.md-icon-button:hover::before {
    opacity: 0.08;
}

.md-icon-button:focus::before {
    opacity: 0.12;
}

.md-icon-button:active::before {
    opacity: 0.16;
}

.md-icon-button:disabled {
    color: rgba(var(--md-sys-color-on-surface), 0.38);
    cursor: not-allowed;
    pointer-events: none;
}

.md-icon-button--filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.md-icon-button--tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.md-icon-button--outlined {
    border: 1px solid var(--md-sys-color-outline);
}

/* === FLOATING ACTION BUTTON === */
.md-fab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    overflow: hidden;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2), 0 6px 10px rgba(0, 0, 0, 0.14), 0 1px 18px rgba(0, 0, 0, 0.12);
}

.md-fab:hover {
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2), 0 8px 10px rgba(0, 0, 0, 0.14), 0 3px 14px rgba(0, 0, 0, 0.12);
}

/* Extended FAB */
.md-fab--extended {
    width: auto;
    min-width: 80px;
    height: 56px;
    padding: 0 16px;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.1px;
}

/* === SEGMENTED BUTTON === */
.md-segmented-button-set {
    display: inline-flex;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-full);
    overflow: hidden;
}

.md-segmented-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-right: 1px solid var(--md-sys-color-outline);
    background-color: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    overflow: hidden;
    min-height: 40px;
}

.md-segmented-button:last-child {
    border-right: none;
}

.md-segmented-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 150ms cubic-bezier(0.2, 0, 0, 1);
}

.md-segmented-button:hover::before {
    opacity: 0.08;
}

.md-segmented-button:focus::before {
    opacity: 0.12;
}

.md-segmented-button:active::before {
    opacity: 0.16;
}

.md-segmented-button--selected {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* === CHIPS === */
.md-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-small);
    background-color: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    overflow: hidden;
    min-height: 32px;
}

.md-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: currentColor;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 150ms cubic-bezier(0.2, 0, 0, 1);
}

.md-chip:hover::before {
    opacity: 0.08;
}

.md-chip:focus::before {
    opacity: 0.12;
}

.md-chip:active::before {
    opacity: 0.16;
}

.md-chip--selected {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

/* === BUTTON WITH ICONS === */
.md-button .material-icons,
.md-button .material-symbols-outlined {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.md-icon-button .material-icons,
.md-icon-button .material-symbols-outlined {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.md-fab .material-icons,
.md-fab .material-symbols-outlined {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* === ERROR VARIANTS === */
.md-button--error {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.md-button--error-outlined {
    background-color: transparent;
    color: var(--md-sys-color-error);
    border-color: var(--md-sys-color-error);
}

.md-button--error-text {
    background-color: transparent;
    color: var(--md-sys-color-error);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .md-button {
        min-height: 48px;
        font-size: 16px;
    }
    
    .md-icon-button {
        width: 44px;
        height: 44px;
    }
    
    .md-fab {
        width: 52px;
        height: 52px;
    }
}